1 %module
"Math::GSL::Sort"
2 /* Danger Will Robinson
! */
4 %include
"gsl_typemaps.i"
6 %typemap
(argout
) (double
* data
, const size_t stride
, const size_t n
) {
11 av_push
(tempav
, newSVnv
((double
) $
1[i
]));
15 $result
= sv_2mortal
( newRV_noinc
( (SV
*) tempav
) );
16 //Perl_sv_dump
($result
);
19 %typemap
(argout
) (double
* dest
, const size_t k
, const gsl_vector
* v
) {
24 av_push
(tempav
, newSVnv
((double
) $
1[i
]));
28 $result
= sv_2mortal
( newRV_noinc
( (SV
*) tempav
) );
32 %typemap
(argout
) (double
* dest
, const size_t k
, const double
* src
, const size_t stride
, const size_t n
) {
36 av_push
(tempav
, newSVnv
((double
) $
1[i
]));
40 $result
= sv_2mortal
( newRV_noinc
( (SV
*) tempav
) );
44 %apply double
* { double
*data
, double
*dest
};
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"
56 %include
"gsl/gsl_nan.h"
57 %include
"gsl/gsl_sort.h"
58 %include
"gsl/gsl_sort_double.h"
59 %include
"gsl/gsl_sort_int.h"
60 %include
"gsl/gsl_sort_vector.h"
61 %include
"gsl/gsl_sort_vector_double.h"
62 %include
"gsl/gsl_sort_vector_int.h"
63 %include
"gsl/gsl_permutation.h"
68 gsl_sort gsl_sort_index
69 gsl_sort_smallest gsl_sort_smallest_index
70 gsl_sort_largest gsl_sort_largest_index
73 gsl_sort_vector gsl_sort_vector_index
74 gsl_sort_vector_smallest gsl_sort_vector_smallest_index
75 gsl_sort_vector_largest gsl_sort_vector_largest_index
77 @EXPORT_OK
= ( @EXPORT_plain
, @EXPORT_vector
);
79 all
=> [ @EXPORT_OK
],
80 plain
=> [ @EXPORT_plain
],
81 vector
=> [ @EXPORT_vector
],
87 Math
::GSL
::Sort
- Functions for sorting data
91 use Math
::GSL
::Sort qw
/:all
/;
92 my $x
= [ 2**15, 1.67, 20e5
,
93 -17, 6900, 1/3 , 42e-10 ];
94 my $sorted
= gsl_sort
($x
, 1, $#$x
+1 );
99 Here is a list of all the functions included in this module
:
103 =item
* gsl_sort_vector
($v
) - This function sorts the elements of the vector $v into ascending numerical order.
105 =item
* gsl_sort_vector_index
($p
, $v
) - This function indirectly sorts the elements of the vector $v into ascending order
, storing the resulting permutation in $p. The elements of $p give the index of the vector element which would have been stored in that position if the vector had been sorted in place. The first element of $p gives the index of the least element in $v
, and the last element of $p gives the index of the greatest element in $v. The vector $v is not changed.
107 =item
* gsl_sort_vector_smallest
109 =item
* gsl_sort_vector_smallest_index
111 =item
* gsl_sort_vector_largest
113 =item
* gsl_sort_vector_largest_index
115 =item
* gsl_sort
($data
, $stride
, $n
) - This function returns an array reference to the sorted $n elements of the array $data with stride $stride into ascending numerical order.
117 =item
* gsl_sort_index
119 =item
* gsl_sort_smallest
121 =item
* gsl_sort_smallest_index
123 =item
* gsl_sort_largest
125 =item
* gsl_sort_largest_index
129 You have to add the functions you want to use inside the qw
/put_funtion_here
/.
130 You can also write use Math
::GSL
::Sort qw
/:all
/ to use all avaible functions of the module.
131 Other tags are also avaible
, here is a complete list of all tags for this module
:
143 For more informations on the functions
, we refer you to the GSL offcial documentation
:
144 L
<http
://www.gnu.org
/software
/gsl
/manual
/html_node
/>
146 Tip
: search on google
: site
:http
://www.gnu.org
/software
/gsl
/manual
/html_node
/ name_of_the_function_you_want
150 Jonathan Leto
<jonathan@leto.net
> and Thierry Moisan
<thierry.moisan@gmail.com
>
152 =head1 COPYRIGHT
AND LICENSE
154 Copyright
(C
) 2008 Jonathan Leto and Thierry Moisan
156 This program is free software
; you can redistribute it and
/or modify it
157 under the same terms as Perl itself.