From: Shu Heng Shu Heng on 16 May 2010 20:37 Thanks for the prompt replies. If I use a mex file to perform the summation, would it be of the same speed as the matlab sum function (excluding the cases where the size of array is sufficient to be ported to BLAS)?
From: Walter Roberson on 16 May 2010 21:10 Shu Heng Shu Heng wrote: > Thanks for the prompt replies. If I use a mex file to perform the > summation, would it be of the same speed as the matlab sum function > (excluding the cases where the size of array is sufficient to be ported > to BLAS)? Hard to say. There are different ways of writing the same functionality, and not all of them are equally efficient in practice; given two different pieces of hardware and two pieces of code, the code that is fastest on the first machine is not necessarily going to be the code that is fastest on the second machine.
From: Steve Amphlett on 17 May 2010 06:10
"Shu Heng Shu Heng" <scilover_8(a)hotmail.com> wrote in message <hsq33f$m61$1(a)fred.mathworks.com>... > Thanks for the prompt replies. If I use a mex file to perform the summation, would it be of the same speed as the matlab sum function (excluding the cases where the size of array is sufficient to be ported to BLAS)? In general, a well written MEX runs faster than an equivalent built-in for these kinds of simple tasks. Until you put in all the error checking and other baggage that's required by a robust function. |