MXV is a MATLAB program which sets up several matrix vector multiplication problems y=A*x, and carries them out using
The user is allowed to specify M and N, the number of matrix rows and columns.
mxv ( m, n )where
M N FLOP FORIFORJ FORJFORI ASTARX 10 10 100 1 0 1 10 100 1000 3 1 8 100 10 1000 1 1 9 10 1,000 10,000 3 1 6 100 100 10,000 2 2 8 1000 10 10,000 1 1 8 10 10,000 100,000 3 1 8 100 1,000 100,000 3 3 9 1,000 100 100,000 3 3 11 10,000 10 100,000 0 0 18 10 100,000 1,000,000 5 1 18 100 10,000 1,000,000 3 4 24 1,000 1,000 1,000,000 4 4 22 10,000 100 1,000,000 0 0 23 100,000 10 1,000,000 0 0 17
These timing results seem very poor. Surprisingly, the tic and toc functions in MATLAB seemed to produce more accurate and reliable timings than the cputime function, which seems to return values only to the nearest 1/100 of a second. Also, MATLAB really does not like to carry out explicit FOR loops. For large values of M or N, some of these loops had abysmal MegaFLOPS ratings.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
MXV is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version.
LINPACK_BENCH, a MATLAB program which measures the time needed to factor and solve a "large" (N=1000) dense linear system of equations, and is used as a benchmark.
MATMUL, a FORTRAN90 program which is an interactive matrix multiplication benchmark program.
MXM, a MATLAB program which sets up a matrix multiplication problem A=B*C of arbitrary size, and compares the time required for IJK, IKJ, JIK, JKI, KIJ and KJI orderings of the loops.
SUM_MILLION, a MATLAB program which sums the integers from 1 to 1,000,000, as a demonstration of how to rate a computer's speed;
TIMER, MATLAB programs which demonstrate how to compute CPU time or elapsed time.
You can go up one level to the MALAB source codes.