Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • 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
Joined
Oct 17, 2002
Messages
1
Location
US
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

 
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

Back
Top