On 29Mar2006, Gorazd Brumen wrote:
 hi,

 the reference to gsl was my next possibility. I compiled the following
 script with mkoctfile

 #include <octave/oct.h>
 #include <math.h>
 #include <gsl/gsl_sf_bessel.h>


 DEFUN_DLD (gn, args, , " gn function") {

 ColumnVector res (1);

 res(1) = gsl_sf_bessel_Jnu (2, 3);

 return octave_value ( res );

 }


 compile with mkoctfile gn.cc lm lgsl lcblas
 and it compiles ok. then when i run it in octave i get

 *** glibc detected *** free(): invalid next size (fast): 0x08b8d140 ***
 panic: Aborted  stopping myself...
 attempting to save variables to `octavecore'...
 save to `octavecore' complete
 Aborted


 octave 2.1.72, ubuntulinux package.


 can someone help me what i am doing wrong?
Probably you want
ColumnVector res (1);
res(0) = gsl_sf_bessel_Jnu (2, 3);
since indexing for ColumnVector objects is 0based. Or, if you just
want to return a scalar value,
return octave_value (gsl_sf_bessel_Jnu (2, 3));
(assuming gsl_sf_bessel_Jnu returns a double value).
jwe

Octave is freely available under the terms of the GNU GPL.
Octave's home on the web:
http://www.octave.orgHow to fund new projects:
http://www.octave.org/funding.htmlSubscription information:
http://www.octave.org/archive.html