The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Message from discussion Matlab faster than C++ ???

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options May 15 2012, 9:40 am
Newsgroups: comp.soft-sys.matlab
From: "Nasser M. Abbasi" <n...@12000.org>
Date: Tue, 15 May 2012 08:40:37 -0500
Local: Tues, May 15 2012 9:40 am
Subject: Re: Matlab faster than C++ ???
On 5/15/2012 6:18 AM, dpb wrote:

> On 5/15/2012 2:48 AM, Tian wrote:
>> Kevin<cuforw...@hotmail.com>  wrote in message
>> Of course, Matlab cannot be faster than C++,...

> Where does the "of course" come into play?

> --

It really all depends on what is being done in terms
of use of external math libraries or not.

Matlab, on intel hardware (may be on AMD also), will
use intel's MKL, a very highly optimized math library
http://en.wikipedia.org/wiki/Math_Kernel_Library

"Intel's Math Kernel Library (MKL) is a library of
optimized, math routines for science, engineering,
and financial applications. Core math functions
include BLAS, LAPACK, ScaLAPACK, Sparse Solvers,
Fast Fourier Transforms, and Vector Math."

So, if someone on Matlab is doing  say x=A\b or A*B,
then Matlab will do this as fast as any body else,
since it will end up making a call to the MKL.

(Actually Matlab's A*B is faster than Fortran's
MATMULT(A,B) based on what I read on the net.
http://gcc.gnu.org/onlinedocs/gfortran/MATMUL.html

But for generic operations, i.e. pure m code,
then would expect C++ generated compiled code, which
does an equivalent algorithm to be faster than Matlab's.

That is why it is good to always try to use Matlab's
build-in functions. They most likely end up making
calls to such libraries as MKL and will be much
faster than home grown pure m code.

--Nasser