Fix remaining Matrix tests and refactor some stuff.
[Math-GSL.git] / GSL.i
blobb934e6d805a0a3a0c391a292a89d7cc123e9a69c
1 %typemap(in) double const [] {
2 AV *tempav;
3 I32 len;
4 int i;
5 SV **tv;
6 if (!SvROK($input))
7 croak("Math::GSL : $input is not a reference!");
8 if (SvTYPE(SvRV($input)) != SVt_PVAV)
9 croak("Math::GSL : $input is not an array ref!");
11 tempav = (AV*)SvRV($input);
12 len = av_len(tempav);
13 $1 = (double *) malloc((len+1)*sizeof(double));
14 for (i = 0; i <= len; i++) {
15 tv = av_fetch(tempav, i, 0);
16 $1[i] = (double) SvNV(*tv);
18 $1[i] = GSL_NAN;
20 %apply double const [] { double *data };
22 %typemap(freearg) double const [] {
23 free($1);