octave-maintainers
[Top][All Lists]
Advanced

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

Re: FYI: sparse indexed assignment rewritten


From: Jaroslav Hajek
Subject: Re: FYI: sparse indexed assignment rewritten
Date: Fri, 16 Apr 2010 11:21:25 +0200

On Wed, Apr 14, 2010 at 3:44 PM, John W. Eaton <address@hidden> wrote:
> On 13-Apr-2010, Jaroslav Hajek wrote:
>
> | I've nearly finished rewriting the sparse indexed assignment code.
> | The old incomprehensible quirky implementation is replaced by a shiny
> | new incomprehensible quirky implementation :)
> | Well at least I tried to comment more. And the code went down from
> | 1100 to 330 lines.
>
> Thanks for working on this big job.
>
> | 2. concatenation doesn't use the new assignment & preallocation
> | mechanism, leading to some ridiculous results:
> |
> | [...]
> |
> | produces this:
> |
> | approach 1: built-in concatenation
> | Elapsed time is 13.6298 seconds.
> | approach 2: hand-coded loop
> | Elapsed time is 0.0499048 seconds.
> |
> | i.e. a built-in operation is 270-times slower than an equivalent
> | interpreted loop (and you thought loops were sluggish? :).
> | It would be cool if sparse concatenation could take advantage of the
> | new speed-ups, but it needs some work. Help is much appreciated.
>
> Ouch, but I'm sure this can be improved.
>

While at it, perhaps it would be prudent to move concat functionality
into liboctave?


> | 3. simple grep query shows that the interpreter uses nzmax at
> | suspiciously many places. I bet some of those usages are wrong and
> | should be nnz, but it requires individual approach. So get ready for
> | mysterious crashes, just in case.
>
> I guess we need to look at all nzmax uses and decide whether they
> should be nnz instead.  Are there any simple rules for when nzmax is
> required?

nzmax is now (as it should have always been) just the amount of space
allocated for nz elements. So probably anything that merely reads the
matrix wants to use nnz(). An exception is conversion (conversions
should preserve nzmax because of spalloc), but I think I already
handled that.

>
> | PS. I feel exhausted today. I'm wondering what heros wrote all that
> | GNU and other free software I use on daily basis, because although it
> | is fun it to improve Octave it also costs me lots of time and
> | energy.
>
> Well, it wasn't written in a day, or by just one person...
>

Oh, yes, I know. Well, I hope at least some of them use Octave, so
that I can pay back.

-- 
RNDr. Jaroslav Hajek, PhD
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]