Weisheng wrote:
> I am trying to use the interface functions between MATLAB/OCTAVE and C
> to compute the matrices algorithms( like matrix-matrix multiplication
> and additon, matrix-vector multiplication ), such as MEX and
> DEFUN_DLD. However, after having compared with Matlab, I found the
> implemented with C/C++ are not faster than the same on in Matlab,
> moreover, it costs more about 30% time. I compared them both in big
> and small matrices multiplications.
> The results are the same as before.
>
> Are there good and bad ways of implementing matrix multiplication
> combining MATLAB/OCTAVE and C?
>
> Thank you very much!
Both Octave and Matlab link to external libraries to perform their
matrix and vector computations, and those libraries are already highly
optimized and probably faster than anything you could using a simple Mex
file. If you want faster matrix math, the ATLAS project has made this an
area of ongoing research. If you are not already using ATLAS libraries
with octave, I suggest downloading them and learning how to optimize
them for your computer.
Quentin