octave-maintainers
[Top][All Lists]
Advanced

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

Re: Improved triu.m and tril.m


From: eat
Subject: Re: Improved triu.m and tril.m
Date: Sun, 24 Jan 2010 09:25:30 -0800 (PST)


Jaroslav Hajek-2 wrote:
> 
>>> Out of interest, do you depend on triu/tril efficiency in an
>>> application?
> 
> 
> Based on a code sent today by David Bateman, I implemented a compiled
> (and extended) version of triu/tril:
> http://hg.savannah.gnu.org/hgweb/octave/rev/b134960cea23
> 
> so you may check that out. Btw, If you want to help improve Octave's
> performance by measuring speed and benchmarks, I'd strongly recommend
> you work with the development sources.
> 
> regards
> 
> -- 
> RNDr. Jaroslav Hajek
> computing expert & GNU Octave developer
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
> 
> 
> 

Hi,

I depend on triu/tril efficiency in some of applications.

As an example when running on my laptop (old Lenovo T42, 512 MB RAM, XP SP3)
following code (striu.m):
function S= striu(S)
        % Sparse triu
        if 0== nargin tst, return, end
        [r, c]= find(S); l= r> c; S(sub2ind(size(S), r(l), c(l)))= false;

function tst
        [computer ', ' version]
        n= 12345; m= 1234; r= unidrnd(n, 1, m); c= unidrnd(n, 1, m);
        S= sparse(r, c, true(1, m)); tic, triu(S); toc, tic, striu(S); toc

I'll get something like:
> striu
ans = i686-pc-mingw32, 3.2.3
Elapsed time is 18.12606 seconds.
Elapsed time is 0.02002909 seconds.

So my naive sparse triu implementation is fast enough for me.

But the main problem is that I'll like to keep my code as compatible as
possible with Matlab and I don't want to maintain any number on my own ad
hoc solutions.

Regards,
eat
-- 
View this message in context: 
http://old.nabble.com/Improved-triu.m-and-tril.m-tp26012709p27297132.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.



reply via email to

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