Fixed GSL_MATRIX_MAX_INDEX .
[Math-GSL.git] / Sort.i
blob6a5f03a839649d349c8cc1e71b6474070d78d43b
1 %module Sort
2 //%include "GSL.i"
4 /* Danger Will Robinson! */
6 %include "typemaps.i"
7 %typemap(in) double * {
8 AV *tempav;
9 I32 len;
10 int i;
11 SV **tv;
12 printf("typemap(in)\n");
13 if (!SvROK($input))
14 croak("Math::GSL : $input is not a reference!");
15 if (SvTYPE(SvRV($input)) != SVt_PVAV)
16 croak("Math::GSL : $input is not an array ref!");
18 tempav = (AV*)SvRV($input);
19 len = av_len(tempav);
20 $1 = (double *) malloc((len+1)*sizeof(double));
21 for (i = 0; i <= len; i++) {
22 tv = av_fetch(tempav, i, 0);
23 $1[i] = (double) SvNV(*tv);
25 $1[i] = GSL_NAN;
28 %typemap(argout) double * {
29 int i=0;
30 AV* tempav = newAV();
32 printf("woohoo $result \n");
34 while( i<= 5 ) {
35 printf("setting stuff %f\n", $1[i]);
36 av_push(tempav, newSVnv((double) $1[i]));
37 i++;
40 $result = sv_2mortal( newRV_noinc( (SV*) tempav) );
41 //Perl_sv_dump($result);
42 argvi++;
45 %apply double * { double *data };
47 void gsl_sort (double * data, const size_t stride, const size_t n);
51 #include "/usr/local/include/gsl/gsl_nan.h"
52 #include "/usr/local/include/gsl/gsl_sort.h"
53 #include "/usr/local/include/gsl/gsl_sort_double.h"
54 #include "/usr/local/include/gsl/gsl_sort_int.h"
55 #include "/usr/local/include/gsl/gsl_sort_vector.h"
56 #include "/usr/local/include/gsl/gsl_sort_vector_double.h"
57 #include "/usr/local/include/gsl/gsl_sort_vector_int.h"
59 %include "/usr/local/include/gsl/gsl_nan.h"
60 %include "/usr/local/include/gsl/gsl_sort.h"
61 %include "/usr/local/include/gsl/gsl_sort_double.h"
62 %include "/usr/local/include/gsl/gsl_sort_int.h"
63 %include "/usr/local/include/gsl/gsl_sort_vector.h"
64 %include "/usr/local/include/gsl/gsl_sort_vector_double.h"
65 %include "/usr/local/include/gsl/gsl_sort_vector_int.h"
68 %perlcode %{
69 @EXPORT_plain = qw/
70 gsl_sort gsl_sort_index
71 gsl_sort_smallest gsl_sort_smallest_index
72 gsl_sort_largest gsl_sort_largest_index
74 @EXPORT_vector= qw/
75 gsl_sort_vector gsl_sort_vector_index
76 gsl_sort_vector_smallest gsl_sort_vector_smallest_index
77 gsl_sort_vector_largest gsl_sort_vector_largest_index
79 @EXPORT_OK = ( @EXPORT_plain, @EXPORT_vector );
80 %EXPORT_TAGS = (
81 all => [ @EXPORT_OK ],
82 plain => [ @EXPORT_plain ],
83 vector => [ @EXPORT_vector ],