[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Better quadrature routine in octave
From: |
Pedro Gonnet |
Subject: |
Re: Better quadrature routine in octave |
Date: |
Mon, 26 Apr 2010 13:48:04 +0100 |
Ok, scratch that last mail... I implemented the function wrapping into
my own Oct-File code which is probably a bit more efficient than using a
wrapper function.
I still think this should be addressed, though, as a documentation bug
-- or as a call for better documentation of how these internal functions
work...
Cheers,
Pedro
On Sun, 2010-04-25 at 19:52 +0100, Pedro Gonnet wrote:
> On Sun, 2010-04-25 at 20:38 +0200, David Bateman wrote:
>
> > Why not use the make_fcn_handle function from ov-fcn-handle.cc to create
> > an anonymous function using the string above with "f" replaced with the
> > string given by the fcn_name method of the ov-fcn-handle class or the
> > the arg itself if a string is passed to your quadrature function?
> >
> > D.
>
> Ok, thanks, that seems to work... Except that if I store the integrand
> "f" as
>
> octave_function *fcn = arg(0).function_value();
>
> and then try to access its name using
>
> fcn->name()
>
> I get an empty string for anonymous functions... Am I doing something
> wrong here? The complete code is
>
> if ( std::isinf(a) || std::isinf(b) ) {
> std::string fstr = "(x) ";
> fstr.append(fcn->name());
> fstr.append("( tan ( pi / 2 * x ) ) .* ( 1 + tan ( pi * x / 2
> ).^2 ) * pi / 2; endfunction;");
> fcn = make_fcn_handle(fstr).function_value();
> for ( i = 0 ; i <= nivals ; i++ )
> if ( std::isinf(iivals[i]) )
> iivals[i] = copysign(1.0,iivals[i]);
> else
> iivals[i] = 2.0 * atan(iivals[i]) / M_PI;
> }
>
> Cheers and thanks again,
> Pedro
>
>