Fix the swap_rowcol Matrix test and suppress fopen/fclose redefinition warnings.
[Math-GSL.git] / Permutation.i
blob6f486d79393a6d8eb6d410402216f461d2a85b41
1 %module Permutation
2 %{
3 #include "/usr/local/include/gsl/gsl_permutation.h"
4 %}
6 %include "/usr/local/include/gsl/gsl_permutation.h"
8 %perlcode %{
9 @EXPORT_OK = qw/
10 gsl_permutation_alloc
11 gsl_permutation_calloc
12 gsl_permutation_init
13 gsl_permutation_free
14 gsl_permutation_memcpy
15 gsl_permutation_fread
16 gsl_permutation_fwrite
17 gsl_permutation_fscanf
18 gsl_permutation_fprintf
19 gsl_permutation_size
20 gsl_permutation_data
21 gsl_permutation_get
22 gsl_permutation_swap
23 gsl_permutation_valid
24 gsl_permutation_reverse
25 gsl_permutation_inverse
26 gsl_permutation_next
27 gsl_permutation_prev
28 gsl_permutation_mul
29 gsl_permutation_linear_to_canonical
30 gsl_permutation_canonical_to_linear
31 gsl_permutation_inversions
32 gsl_permutation_linear_cycles
33 gsl_permutation_canonical_cycles
35 %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
37 ### wrapper interface ###
38 sub new {
39 my ($class, $value) = @_;
40 my $this = {};
41 $this->{_permutation} = gsl_permutation_alloc($value);
42 bless $this, $class;
45 __END__
47 =head1 NAME
49 Math::GSL::Permutation
51 =head1 SYPNOPSIS
53 use Math::GSL::Permutation qw/:all/;
55 =head1 DESCRIPTION
56 Here is a list of all the functions included in this module :
57 gsl_permutation_alloc($n) - return a newly allocated permutation of size $n
58 gsl_permutation_calloc($n) - return a newly allocated permutation of size $n which is initialized to the identity
59 gsl_permutation_init($p) - initialize the permutation $p to the identity i.e. (0,1,2, ..., n-1)
60 gsl_permutation_free($p) - free all the memory use by the permutaion $p
61 gsl_permutation_memcpy($dest, $src) - copy the permutation $src into the permutation $dest, the two permutations must have the same lenght and return 0 if the operation suceeded, 1 otherwise
62 gsl_permutation_fread
63 gsl_permutation_fwrite
64 gsl_permutation_fscanf
65 gsl_permutation_fprintf
66 gsl_permutation_size($p) - return the size of the permutation $p
67 gsl_permutation_data
68 gsl_permutation_get($p, $i) - return the $i-th element of the permutation $p, return 0 if $i is outside the range of 0 to n-1
69 gsl_permutation_swap($p, $i, $j) - exchange the $i-th position and the $j-th position of the permutation $p and return 0 if the operation suceeded, 1 otherwise
70 gsl_permutation_valid($p) - return 0 if the permutation $p is valid (if the n elements contain each of the numbers 0 to n-1 once and only once), 1 otherwise
71 gsl_permutation_reverse($p) - reverse the elements of the permutation $p
72 gsl_permutation_inverse($inv, $p) - compute the inverse of the permutation $p, storing it in $inv and return 0 if the operation succeeded, 1 otherwise
73 gsl_permutation_next($p) - advance the permutation $p to the next permutation in lexicographic order and return 0 if the operation succeeded, 1 otherwise
74 gsl_permutation_prev($p) - step backward from the permutation $p to the previous permutation in lexicographic order and return 0 if the operation suceeded, 1 otherwise
75 gsl_permutation_mul($p, $pa, $pb) - combine the two permutation $pa and $pb into a single permutation $p and return 0 if the operation suceeded, 1 otherwise
76 gsl_permutation_linear_to_canonical($q, $p) - compute the canonical form the permutation $p and store it in $q and return 0 if the operation suceeded, 1 otherwise
77 gsl_permutation_canonical_to_linear($p, $q) - convert a canonical permutation $q back into linear form and store it in $p and return 0 if the operation suceeded, 1 otherwise
78 gsl_permutation_inversions($p) - return the number of inversions in the permutation $p
79 gsl_permutation_linear_cycles($p) - return the number of cycles in the permutation $p, given a linear form
80 gsl_permutation_canonical_cycles($p) - return the number of cycles in the permutation $p, given a canonical form
82 You have to add the functions you want to use inside the qw /put_funtion_here / with spaces between each function. You can also write use Math::GSL::CDF qw/:all/ to use all avaible functions of the module. Other tags are also avaible, here is a complete list of all tags for this module.
84 For more informations on the functions, we refer you to the GSL offcial documentation: http://www.gnu.org/software/gsl/manual/html_node/
85 Tip : search on google: site:http://www.gnu.org/software/gsl/manual/html_node/ name_of_the_function_you_want
87 =head1 EXAMPLES
89 =head1 AUTHOR
91 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
93 =head1 COPYRIGHT AND LICENSE
95 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
97 This program is free software; you can redistribute it and/or modify it
98 under the same terms as Perl itself.
100 =cut