Measuring programming progress by lines of code is like measuring aircraft building progress by weight. Bill Gates

Verify matrix multiplication

Language Java | Level Intermediate | Category Algorithms | August 5, 2015 9:06 am

Algorithm Problem Description

Freivalds algorithm is used to verify the correctness of the matrix multiplication. We can also use the native way to verify the matrix multiplication. But the current method is slow. It is a probabilistic randomized algorithm used to verify matrix multiplication.

A native algorithm would compute the product A x B explicitly and compare term by term whether this product equals C. Write a program to verify the matrix multiplication using Freivalds algorithm.



Dimesion of the matrices: 2
Matrix One values: [[2.0, 3.0], [3.0, 4.0]]
Matrix two values: [[1.0, 1.0], [0.0, 2.0]]
Result Matrix values: [[6.0, 5.0], [8.0, 7.0]]
Failed to verify matrix multiplication using Freivalds algorithm



Please login to add comments.