Adding matrix_complex functions to the Matrix subsystem and adding gsl_eigen_herm...
[Math-GSL.git] / Sort.i
blob368360292eabefa958f851c03c08347fbbed93d9
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 if (!SvROK($input))
13 croak("Math::GSL : $input is not a reference!");
14 if (SvTYPE(SvRV($input)) != SVt_PVAV)
15 croak("Math::GSL : $input is not an array ref!");
17 tempav = (AV*)SvRV($input);
18 len = av_len(tempav);
19 $1 = (double *) malloc((len+1)*sizeof(double));
20 for (i = 0; i <= len; i++) {
21 tv = av_fetch(tempav, i, 0);
22 $1[i] = (double) SvNV(*tv);
26 %typemap(argout) double * {
27 int i=0;
28 AV* tempav = newAV();
30 // Need to determine length of $1
31 while( i<= 5 ) {
32 //printf("setting stuff %f\n", $1[i]);
33 av_push(tempav, newSVnv((double) $1[i]));
34 i++;
37 $result = sv_2mortal( newRV_noinc( (SV*) tempav) );
38 //Perl_sv_dump($result);
39 argvi++;
42 %apply double * { double *data };
45 #include "/usr/local/include/gsl/gsl_nan.h"
46 #include "/usr/local/include/gsl/gsl_sort.h"
47 #include "/usr/local/include/gsl/gsl_sort_double.h"
48 #include "/usr/local/include/gsl/gsl_sort_int.h"
49 #include "/usr/local/include/gsl/gsl_sort_vector.h"
50 #include "/usr/local/include/gsl/gsl_sort_vector_double.h"
51 #include "/usr/local/include/gsl/gsl_sort_vector_int.h"
53 %include "/usr/local/include/gsl/gsl_nan.h"
54 %include "/usr/local/include/gsl/gsl_sort.h"
55 %include "/usr/local/include/gsl/gsl_sort_double.h"
56 %include "/usr/local/include/gsl/gsl_sort_int.h"
57 %include "/usr/local/include/gsl/gsl_sort_vector.h"
58 %include "/usr/local/include/gsl/gsl_sort_vector_double.h"
59 %include "/usr/local/include/gsl/gsl_sort_vector_int.h"
62 %perlcode %{
63 @EXPORT_plain = qw/
64 gsl_sort gsl_sort_index
65 gsl_sort_smallest gsl_sort_smallest_index
66 gsl_sort_largest gsl_sort_largest_index
68 @EXPORT_vector= qw/
69 gsl_sort_vector gsl_sort_vector_index
70 gsl_sort_vector_smallest gsl_sort_vector_smallest_index
71 gsl_sort_vector_largest gsl_sort_vector_largest_index
73 @EXPORT_OK = ( @EXPORT_plain, @EXPORT_vector );
74 %EXPORT_TAGS = (
75 all => [ @EXPORT_OK ],
76 plain => [ @EXPORT_plain ],
77 vector => [ @EXPORT_vector ],