Update META.yml
[Math-GSL.git] / Sort.i
blob5054eb709548de690f753d775488cf70095a61cd
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++;
20 %typemap(argout) (double * dest, const size_t k, const gsl_vector * v) {
21 fprintf(stderr, "matched argout\n");
22 int i=0;
23 AV* tempav = newAV();
25 while( i < $2 ) {
26 av_push(tempav, newSVnv((double) $1[i]));
27 i++;
30 $result = sv_2mortal( newRV_noinc( (SV*) tempav) );
31 argvi++;
35 %apply double * { double *data, double *dest };
38 #include "gsl/gsl_nan.h"
39 #include "gsl/gsl_sort.h"
40 #include "gsl/gsl_sort_double.h"
41 #include "gsl/gsl_sort_int.h"
42 #include "gsl/gsl_sort_vector.h"
43 #include "gsl/gsl_sort_vector_double.h"
44 #include "gsl/gsl_sort_vector_int.h"
45 #include "gsl/gsl_permutation.h"
47 %include "gsl/gsl_nan.h"
48 %include "gsl/gsl_sort.h"
49 %include "gsl/gsl_sort_double.h"
50 %include "gsl/gsl_sort_int.h"
51 %include "gsl/gsl_sort_vector.h"
52 %include "gsl/gsl_sort_vector_double.h"
53 %include "gsl/gsl_sort_vector_int.h"
54 %include "gsl/gsl_permutation.h"
57 %perlcode %{
58 @EXPORT_plain = qw/
59 gsl_sort gsl_sort_index
60 gsl_sort_smallest gsl_sort_smallest_index
61 gsl_sort_largest gsl_sort_largest_index
63 @EXPORT_vector= qw/
64 gsl_sort_vector gsl_sort_vector_index
65 gsl_sort_vector_smallest gsl_sort_vector_smallest_index
66 gsl_sort_vector_largest gsl_sort_vector_largest_index
68 @EXPORT_OK = ( @EXPORT_plain, @EXPORT_vector );
69 %EXPORT_TAGS = (
70 all => [ @EXPORT_OK ],
71 plain => [ @EXPORT_plain ],
72 vector => [ @EXPORT_vector ],
74 __END__
76 =head1 NAME
78 Math::GSL::Sort - Functions for sorting data
80 =head1 SYNOPSIS
82 use Math::GSL::Sort qw/:all/;
83 my $x = [ 2**15, 1.67, 20e5,
84 -17, 6900, 1/3 , 42e-10 ];
85 my $sorted = gsl_sort($x, 1, $#$x+1 );
88 =head1 DESCRIPTION
90 Here is a list of all the functions included in this module :
92 =over
94 =item gsl_sort_vector($v) - This function sorts the elements of the vector v into ascending numerical order.
96 =item gsl_sort_vector_index
98 =item gsl_sort_vector_smallest
100 =item gsl_sort_vector_smallest_index
102 =item gsl_sort_vector_largest
104 =item gsl_sort_vector_largest_index
106 =item gsl_sort
108 =item gsl_sort_index
110 =item gsl_sort_smallest
112 =item gsl_sort_smallest_index
114 =item gsl_sort_largest
116 =item gsl_sort_largest_index
118 =back
120 You have to add the functions you want to use inside the qw /put_funtion_here /.
121 You can also write use Math::GSL::Sort qw/:all/ to use all avaible functions of the module.
122 Other tags are also avaible, here is a complete list of all tags for this module :
124 =over
126 =item all
128 =item plain
130 =item vector
132 =back
134 For more informations on the functions, we refer you to the GSL offcial documentation: http://www.gnu.org/software/gsl/manual/html_node/
135 Tip : search on google: site:http://www.gnu.org/software/gsl/manual/html_node/ name_of_the_function_you_want
137 =head1 EXAMPLES
139 =head1 AUTHORS
141 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
143 =head1 COPYRIGHT AND LICENSE
145 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
147 This program is free software; you can redistribute it and/or modify it
148 under the same terms as Perl itself.
150 =cut