[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: |
Sun, 25 Apr 2010 21:09:53 +0200 |
On Sat, Apr 24, 2010 at 10:32 PM, Pedro Gonnet <address@hidden> wrote:
>
> Hello again,
>
> I'm currently re-writing the C-language version as an Oct-file. The
> documentation is a bit shaky, but I can get by on the examples except
> for one thing: When I call the integrand (I'm using an octave_function
> *fcn), I need to generate a vector of values "x" to compute "y = f(x)".
> I have to do this often and for vectors "x" of length 5, 17, 33, 3, 7,
> 15 and 31.
>
> I'm guessing the most efficient way would be do declare one Matrix
> object of length 33 and then, whenever I call the integrand, fill it
> with the values of "x" I need and somehow tell the Matrix to truncate
> its own length.
>
> Unfortunately, I have no idea how to do this. In MEX, I would do this
> with mxSetM(...), but with Octave I don't even know if I should declare
> a Matrix or an NDArray... Any help anyone?
>
> Cheers,
> Pedro
>
If you really think you need to optimize at this level, you can simply
prepare a set of Matrix objects of all the length you need, and always
use one of them. It doesn't matter whether you use Matrix or NDArray
as long as your data is up to 2 dimensions.
The internal storage uses NDArray but wrapping to octave_value
involves essentially the same work.
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Re: Better quadrature routine in octave, Pedro Gonnet, 2010/04/01
- Re: Better quadrature routine in octave, Jaroslav Hajek, 2010/04/01
- Re: Better quadrature routine in octave, Pedro Gonnet, 2010/04/06
- Re: Better quadrature routine in octave, Pedro Gonnet, 2010/04/13
- Re: Better quadrature routine in octave, Jaroslav Hajek, 2010/04/15
- Re: Better quadrature routine in octave, Pedro Gonnet, 2010/04/16
- Re: Better quadrature routine in octave, Pedro Gonnet, 2010/04/23
- Re: Better quadrature routine in octave, Pedro Gonnet, 2010/04/24
- Re: Better quadrature routine in octave, John W. Eaton, 2010/04/24
- Re: Better quadrature routine in octave,
Jaroslav Hajek <=