help-octave
[Top][All Lists]
Advanced

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

Re: 'for' loop vectorization


From: John W. Eaton
Subject: Re: 'for' loop vectorization
Date: Wed, 24 Oct 2007 14:53:37 -0400

On 24-Oct-2007, Francesco Potorti` wrote:

| I managed to obtain a slight speedup of the triu function like this:
| 
| octave> n=3000
| n =  3000
| octave> t=cputime;a=triu(ones(n,n));cputime-t
| ans =  0.77605
| octave> 
t=cputime;b=ones(n,n);z=0:n*n-1;b((((0:n-1)'*ones(1,n))(:))'>z/n)=0;cputime-t
| ans =  0.69204
| octave> all(all(a==b))
| ans =  1

If you want to discuss this, please follow-up on the thread that was
started earlier today on the maintainers list.

jwe



reply via email to

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