Adding a test to Interp and a new typemap
[Math-GSL.git] / Sort.i
blob3713868e2670bbd87bc69c29a9ce97c5ab6a11d9
1 %module "Math::GSL::Sort"
2 /* Danger Will Robinson! */
4 %include "typemaps.i"
5 %include "gsl_typemaps.i"
7 %typemap(argout) (double * data, const size_t stride, const size_t n) {
8 int i=0;
9 AV* tempav = newAV();
11 while( i < $3 ) {
12 av_push(tempav, newSVnv((double) $1[i]));
13 i++;
16 $result = sv_2mortal( newRV_noinc( (SV*) tempav) );
17 //Perl_sv_dump($result);
18 argvi++;
21 %apply double * { double *data };
24 #include "gsl/gsl_nan.h"
25 #include "gsl/gsl_sort.h"
26 #include "gsl/gsl_sort_double.h"
27 #include "gsl/gsl_sort_int.h"
28 #include "gsl/gsl_sort_vector.h"
29 #include "gsl/gsl_sort_vector_double.h"
30 #include "gsl/gsl_sort_vector_int.h"
32 %include "gsl/gsl_nan.h"
33 %include "gsl/gsl_sort.h"
34 %include "gsl/gsl_sort_double.h"
35 %include "gsl/gsl_sort_int.h"
36 %include "gsl/gsl_sort_vector.h"
37 %include "gsl/gsl_sort_vector_double.h"
38 %include "gsl/gsl_sort_vector_int.h"
41 %perlcode %{
42 @EXPORT_plain = qw/
43 gsl_sort gsl_sort_index
44 gsl_sort_smallest gsl_sort_smallest_index
45 gsl_sort_largest gsl_sort_largest_index
47 @EXPORT_vector= qw/
48 gsl_sort_vector gsl_sort_vector_index
49 gsl_sort_vector_smallest gsl_sort_vector_smallest_index
50 gsl_sort_vector_largest gsl_sort_vector_largest_index
52 @EXPORT_OK = ( @EXPORT_plain, @EXPORT_vector );
53 %EXPORT_TAGS = (
54 all => [ @EXPORT_OK ],
55 plain => [ @EXPORT_plain ],
56 vector => [ @EXPORT_vector ],
58 __END__
60 =head1 NAME
62 Math::GSL::Sort - Functions for sorting data
64 =head1 SYNOPSIS
66 use Math::GSL::Sort qw/:all/;
67 my $x = [ 2**15, 1.67, 20e5,
68 -17, 6900, 1/3 , 42e-10 ];
69 my $sorted = gsl_sort($x, 1, $#$x+1 );
72 =head1 DESCRIPTION
74 Here is a list of all the functions included in this module :
76 =over
78 =item gsl_sort_vector($v) - This function sorts the elements of the vector v into ascending numerical order.
80 =item gsl_sort_vector_index
82 =item gsl_sort_vector_smallest
84 =item gsl_sort_vector_smallest_index
86 =item gsl_sort_vector_largest
88 =item gsl_sort_vector_largest_index
90 =item gsl_sort
92 =item gsl_sort_index
94 =item gsl_sort_smallest
96 =item gsl_sort_smallest_index
98 =item gsl_sort_largest
100 =item gsl_sort_largest_index
102 =back
104 You have to add the functions you want to use inside the qw /put_funtion_here /.
105 You can also write use Math::GSL::Sort qw/:all/ to use all avaible functions of the module.
106 Other tags are also avaible, here is a complete list of all tags for this module :
108 =over
110 =item all
112 =item plain
114 =item vector
116 =back
118 For more informations on the functions, we refer you to the GSL offcial documentation: http://www.gnu.org/software/gsl/manual/html_node/
119 Tip : search on google: site:http://www.gnu.org/software/gsl/manual/html_node/ name_of_the_function_you_want
121 =head1 EXAMPLES
123 =head1 AUTHORS
125 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
127 =head1 COPYRIGHT AND LICENSE
129 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
131 This program is free software; you can redistribute it and/or modify it
132 under the same terms as Perl itself.
134 =cut