POD cleanup and basic Histogram POD.
[Math-GSL.git] / Sort.i
blob3c34e9a7a164b55ab284943eb9d3e0fb05e19121
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 "gsl/gsl_nan.h"
46 #include "gsl/gsl_sort.h"
47 #include "gsl/gsl_sort_double.h"
48 #include "gsl/gsl_sort_int.h"
49 #include "gsl/gsl_sort_vector.h"
50 #include "gsl/gsl_sort_vector_double.h"
51 #include "gsl/gsl_sort_vector_int.h"
53 %include "gsl/gsl_nan.h"
54 %include "gsl/gsl_sort.h"
55 %include "gsl/gsl_sort_double.h"
56 %include "gsl/gsl_sort_int.h"
57 %include "gsl/gsl_sort_vector.h"
58 %include "gsl/gsl_sort_vector_double.h"
59 %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 ],
79 __END__
81 =head1 NAME
83 Math::GSL::Sort - Functions for sorting data
85 =head1 SYNOPSIS
87 use Math::GSL::Sort qw/:all/;
89 =head1 DESCRIPTION
91 Here is a list of all the functions included in this module :
93 =over
95 =item gsl_sort_vector($v) - This function sorts the elements of the vector v into ascending numerical order.
97 =item gsl_sort_vector_index
99 =item gsl_sort_vector_smallest
101 =item gsl_sort_vector_smallest_index
103 =item gsl_sort_vector_largest
105 =item gsl_sort_vector_largest_index
107 =item gsl_sort
109 =item gsl_sort_index
111 =item gsl_sort_smallest
113 =item gsl_sort_smallest_index
115 =item gsl_sort_largest
117 =item gsl_sort_largest_index
119 =back
121 You have to add the functions you want to use inside the qw /put_funtion_here /.
122 You can also write use Math::GSL::Sort qw/:all/ to use all avaible functions of the module.
123 Other tags are also avaible, here is a complete list of all tags for this module :
125 =over
127 =item all
129 =item plain
131 =item vector
133 =back
135 For more informations on the functions, we refer you to the GSL offcial documentation: http://www.gnu.org/software/gsl/manual/html_node/
136 Tip : search on google: site:http://www.gnu.org/software/gsl/manual/html_node/ name_of_the_function_you_want
138 =head1 EXAMPLES
140 =head1 AUTHORS
142 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
144 =head1 COPYRIGHT AND LICENSE
146 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
148 This program is free software; you can redistribute it and/or modify it
149 under the same terms as Perl itself.
151 =cut