[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fwd: 'for' loop vectorization
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Fwd: 'for' loop vectorization |
Date: |
Tue, 23 Oct 2007 19:45:34 -0500 |
Forwarding this discussion to the dev list per jwe's suggestion...
---------- Forwarded message ----------
From: Jordi Gutiérrez Hermoso <address@hidden>
Date: 23 Oct 2007 16:24
Subject: Re: 'for' loop vectorization
To: "John W. Eaton" <address@hidden>
Cc: Octave Help <address@hidden>
On 23/10/2007, John W. Eaton <address@hidden> wrote:
> On 23-Oct-2007, Jordi Gutiérrez Hermoso wrote:
>
> | On 23/10/2007, Hermann Schwarting <address@hidden> wrote:
> | > The more I think about it, it looks like I can't vectorize this. It's
> | > a bit similar to a cumulative maximum, which can't be vectorized
> | > either, I think.
> |
> | It can be, but my vectorisation runs slower than the unvectorised code. :-(
> |
> | a = max(triu(repmat(a(:),1,length(a))))
> |
> | The triu call is the bottleneck, it seems, which mystifies me.
>
> The triu function is a .m file with a for loop.
Yeah, I just realised. That should be fixed, eh? I also see that it's
very old and uses a weird construct instead of calling zeros(nr,nc).
I'm trying to think of a way to avoiding the for-loops in tril and
triu, but perhaps they should just be compiled in. What do you think?
- Jordi G. H.
- Fwd: 'for' loop vectorization,
Jordi Gutiérrez Hermoso <=