2 %include
"gsl/gsl_nan.h"
3 #ifdef GSL_MINOR_VERSION
&& GSL_MINOR_VERSION >= 12
4 %include
"gsl_inline.h"
8 #include
"gsl/gsl_nan.h"
11 %typemap
(in
) double const
[] {
17 croak
("Math::GSL : $$1_name is not a reference!");
18 if
(SvTYPE
(SvRV
($input
)) != SVt_PVAV
)
19 croak
("Math::GSL : $$1_name is not an array ref!");
21 tempav
= (AV
*)SvRV
($input
);
23 $
1 = (double
*) malloc
((len
+1)*sizeof
(double
));
24 for
(i
= 0; i
<= len
; i
++) {
25 tv
= av_fetch
(tempav
, i
, 0);
26 $
1[i
] = (double
) SvNV
(*tv
);
30 %apply double const
[] {
31 size_t
*p
,double
*data
, double
*dest
, double
*f_in
, double
*f_out
,
32 double data
[], const double
* src
, double x
[], double a
[], double b
[] ,
33 const double
* x
, const double
* y
, const double
* w
, const double x_array
[],
34 const double xrange
[], const double yrange
[], double
* base
,
35 const double
* base
, const double xrange
[], const double yrange
[] ,
36 const double
* array
, const double data2
[], const double w
[] ,
37 float const
*A
, float const
*B
, float const
*C
, float
*C
, double
*v
,
38 gsl_complex_packed_array data
41 %apply int
*OUTPUT { size_t
*imin
, size_t
*imax
, size_t
*neval
};
42 %apply double
* OUTPUT {
43 double
* min_out
, double
* max_out
,
44 double
*abserr
, double
*result
47 static HV
* Callbacks
= (HV
*)NULL;
48 /* this function returns the value
49 of evaluating the function pointer
50 stored in func with argument x
52 double callthis
(double x
, int func
, void
*params
){
58 //fprintf
(stderr
, "LOOKUP CALLBACK\n");
59 sv
= hv_fetch
(Callbacks
, (char
*)func
, sizeof
(func
), FALSE );
60 if
(sv
== (SV
**)NULL) {
61 fprintf
(stderr
, "Math::GSL(callthis): %d not in Callbacks!\n", func
);
66 XPUSHs
(sv_2mortal
(newSVnv
((double
)x
)));
67 PUTBACK
; /* make local stack pointer global
*/
69 count
= call_sv
(*sv
, G_SCALAR
);
73 croak
("Expected to call subroutine in scalar context!");
75 PUTBACK
; /* make local stack pointer global
*/
80 double callmonte
(double x
[], size_t dim
, void
*params
){
81 fprintf
(stderr
, "callmonte!!!");
84 %typemap
(in
) gsl_monte_function
* {
85 gsl_monte_function MF
;
90 croak
("Math::GSL : $$1_name is not a reference value!");
92 if
(Callbacks
== (HV
*)NULL)
94 fprintf
(stderr
,"STORE $$1_name gsl_monte_function CALLBACK: %d\n", (int
)$input
);
95 hv_store
( Callbacks
, (char
*)&$input, sizeof($input), newSVsv($input), 0 );
103 %typemap
(in
) gsl_function
* {
109 if
(!SvROK
($input
)) {
110 croak
("Math::GSL : $$1_name is not a reference value!");
112 if
(Callbacks
== (HV
*)NULL)
114 //fprintf
(stderr
,"STORE CALLBACK: %d\n", (int
)$input
);
115 hv_store
( Callbacks
, (char
*)&$input, sizeof($input), newSVsv($input), 0 );
118 F.function
= &callthis;
122 %typemap
(in
) gsl_function_fdf
* {
123 fprintf
(stderr
, 'FDF_FUNC'
);