octave-maintainers
[Top][All Lists]
Advanced

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

Re: 'for' loop vectorization


From: David Bateman
Subject: Re: 'for' loop vectorization
Date: Wed, 24 Oct 2007 23:14:51 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Jordi Gutiérrez Hermoso wrote:
> On 24/10/2007, John W. Eaton <address@hidden> wrote:
>> The nice thing about triu being a script is that it is generic and
>> should work for any data type.  It might be more work to do that in
>> C++ for all data types.
> 
> Although I probably should get more familiar with Octave's source
> before I make such bold-faced comments, isn't this what C++
> polymorphism is for?

The C++ code i sent has a polymorphic version that is just as slow as
the m-file version (or almost), that is why there are the special cases
for the octave core types (for speed). Also compare the C++ and m-file
versions for maintainability: The m-file version is probably much easier
to maintain.. That of course must be offset by the speed of the oct-file
version and the number of places where triu/tril is likely to be used...
If the answer to the above is "it'll be used in lots of places", then we
should probably pay the penalty of harder maintenance of the code.

D.


reply via email to

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