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: Jaroslav Hajek
Subject: Re: Improved triu.m and tril.m
Date: Fri, 23 Oct 2009 11:01:48 +0200

On Fri, Oct 23, 2009 at 9:52 AM, Marco Caliari <address@hidden> wrote:
>> using cellslices + vertcat + reshape is faster still:
>>
>>  m = min (nc, nr+k);
>>  ii = max (1, (1:m) - k);
>>
>>  sl(2,:) = cellslices (x(:), ii, nr*ones (1, m));
>>  sl(1,:) = cellslices (zeros (nr, 1), ones (1, m), ii - 1);
>>
>>  retval = reshape (vertcat (sl{:}), nr, nc);
>
> Great, even if, it does not work for me... I think the problem is related to
> what I get with 3.2.3
>
> octave:1> cellslices([1,2],1,0)
> error: subscript indices must be either positive integers or logicals.
>

Yes, this was already fixed in development tip.

> Maybe the result should be
>
> {
>  [1,1] = [](1x0)
> }
>
> Also this appears strange to me
>
> octave:1> cellslices([1,2,3],[2,3],[1,1])
> error: invalid range used as index.
>

Huh. One more bug. A fix is here:
http://hg.savannah.gnu.org/hgweb/octave/rev/95ad9c2a27e2


>> Out of interest, do you depend on triu/tril efficiency in an application?
>
> Not really. I had a code with fft and matrix manipulations and it was slower
> in Octave than in Matlab just because of a final triu.
>
> Cheers,
>
> Marco
>

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



reply via email to

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