help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A faster sum


From: Victor Eijkhout
Subject: Re: A faster sum
Date: Sat, 21 May 2005 10:42:19 -0400


On May 21, 2005, at 10:35 AM, Keith Goodman wrote:

Matrix multiplication is sometimes a lot faster than matrix addition.

On an operation by operation basis, yes.

So instead of sum(x,1) and sum(x,2) you can use ones(1,size(x,1))*x
and x*ones(size(x,2),1).

What are the pros and cons of using this method for 2D matrices in
Octave's built-in sum function?

You're replacing n^2 operations by n^3. Those operations run faster, but there are many more of them.

V.



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]