Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why matlab is fast in matrix multiplication

Status
Not open for further replies.

chfshe

Industrial
Oct 17, 2002
1
Does anybody know how matlab handle the matrix multiplication? I tested with 2 200-square matrices(elements are from uniform distribution of (0,1) and found out the calculation times as follows:
matlab : 0.016
fortran: 0.425
VC : 0.195
VB : 1.998
The speed is so fast. it must have used some memory optimization. Anybody know some detail about this?

Thx

 
Replies continue below

Recommended for you

Matlab was specifically written as a "matrix laboratory", so one would hope that it was fast at manipulating matrices.

As for speed, presumably, the Matlab code is both optimized and possibly written in assembler.

Unless you were the optimizer, it's unlikely that you're comparing apples to apples. One critical optimization is to make sure that matrix indexing occurs quickly, going against the grain can sloooooow down matrix math substantially.

TTFN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor