Fiddle with Eigen+FFT tests and add nonsymmetric eigenvalue example
[Math-GSL.git] / swig / Deriv.i
blobf5bab55015b40ec7396cf79937fe11a60f535603
1 %module "Math::GSL::Deriv"
2 // Danger Will Robinson, for realz!
4 %include "typemaps.i"
5 %include "gsl_typemaps.i"
6 %typemap(argout) (const gsl_function *f,
7 double x, double h,
8 double *result, double *abserr) {
9 SV ** sv;
11 sv = hv_fetch(Callbacks, (char*)&$input, sizeof($input), FALSE );
12 if (sv == (SV**)NULL)
13 croak("Math::GSL(argout) : Missing callback!\n");
14 dSP;
16 PUSHMARK(SP);
17 // these are the arguments passed to the callback
18 XPUSHs(sv_2mortal(newSViv((int)$2)));
19 // shouldnt we be doing something with $3 ?
20 PUTBACK;
22 /* This actually calls the perl subroutine, in scalar context */
23 call_sv(*sv, G_SCALAR);
25 $result = sv_newmortal();
26 sv_setnv($result, (double) *$4);
27 argvi++;
28 sv_setnv($result, (double) *$5);
29 argvi++;
31 if (argvi >= items) {
32 EXTEND(SP,1);
36 // this is rarely prudent but seems to work
37 %typemap(in) void * {
38 $1 = (double *) $input;
41 #include "gsl/gsl_math.h"
42 #include "gsl/gsl_deriv.h"
45 %include "gsl/gsl_math.h"
46 %include "gsl/gsl_deriv.h"
47 %include "../pod/Deriv.pod"