octave-maintainers
[Top][All Lists]
Advanced

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

Re: Better quadrature routine in octave


From: Jaroslav Hajek
Subject: Re: Better quadrature routine in octave
Date: Fri, 2 Apr 2010 07:54:23 +0200

On Thu, Apr 1, 2010 at 10:04 PM, David Bateman <address@hidden> wrote:
> Jaroslav Hajek wrote:
>>
>> On Wed, Mar 31, 2010 at 12:03 AM, Pedro Gonnet <address@hidden>
>> wrote:
>>
>>>>
>>>> Writing it in C++ using the oct-file interface might be a good thing as
>>>> well.
>>>>
>>>
>>> This should not be a problem as I was planning on writing a C-language
>>> version for the GNU Scientific Library anyway. I guess there is a
>>> documentation somewhere for using this interface?
>>>
>>>
>>
>> I advise you not to do it until it becomes apparent that the m-file
>> version can't be optimized to provide satisfactory performance.
>> Having algorithms in m-files has certain advantages, in particular
>> that it is easier for people to play with them.
>>
>> If you come up with a version that can replace quad (if I understood
>> correctly, it suffices to add handling of singular points)
>> and adapt it somewhat to the coding standards (at least the major
>> points, i.e. consistent comments, specific block ends), I can help you
>> with optimizations, should any be needed.
>>
>>
>
> There were a few a couple of reason I suggested this. Firstly, with quad
> already as an oct-file the input parsing part is already coded,

That's a good point.

> and the code
> has a loop in it over the set of unconverged segments that I don't think
> would be possible to vectorize

If you're referring to the main while loop, it's true, but it contains
so much work per iteration that the interpreter overhead of the loop
itself is surely negligible. Basically, whenever there's a function
handle involved, you can't avoid at least the overhead of the function
invocation, and if it's a sloppy enough m-file function, it might not
make a visible difference even if you implemented the rest in
super-optimized C++.

> and so writing it as C/C++ might make a
> significant difference in speed to the algorithm in Octave.
>

Perhaps. As I said, a lot also depends on the function itself.


-- 
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]