
Math::GSL::Permutation - functions for creating and manipulating permutations

use Math::GSL::Permutation qw/:all/;

Here is a list of all the functions included in this module :
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. For more informations on the functions, we refer you to the GSL offcial documentation: L<http://www.gnu.org/software/gsl/manual/html_node/> Tip : search on google: site:http://www.gnu.org/software/gsl/manual/html_node/ name_of_the_function_you_want

use Math::GSL::Permutation qw/:all/;
$p->{permutation} = gsl_permutation_calloc(5);
print "The permutation contains [";
map { print gsl_permutation_get($p->{permutation}, $_) . ", " } (0..3);
print gsl_permutation_get($p->{permutation}, 4);
print "] \n";
print "We'll then swap the first and last elements of the permutation...\n";
gsl_permutation_swap($p->{permutation}, 0, 4);
print "The permutation now contains [";
map { print gsl_permutation_get($p->{permutation},$_) . ", " } (0..3);
print gsl_permutation_get($p->{permutation}, 4);
print "] \n";
use Math::GSL::Permutation qw/:all/;
use Math::GSL::Vector qw/:all/;
my $p->{permutation} = gsl_permutation_calloc(6);
gsl_permutation_init($p->{permutation});
gsl_permutation_swap($p->{permutation}, 0, 1);
print "The permutation has his first and second elements swapped : [";
map { print gsl_permutation_get($p->{permutation}, $_) . "," } (0..4);
print gsl_permutation_get($p->{permutation}, 5) . "] \n";
my $vec->{vector} = gsl_vector_alloc(6);
map { gsl_vector_set($vec->{vector}, $_, $_) } (0..5);
print "We will now apply the permutation to this vector : [";
map { print gsl_vector_get($vec->{vector}, $_) . "," } (0..4);
print gsl_vector_get($vec->{vector}, 5) . "] \n";
gsl_permute_vector($p->{permutation}, $vec->{vector});
print "The vector is now : [";
map { print gsl_vector_get($vec->{vector}, $_) . "," } (0..4);
print gsl_vector_get($vec->{vector}, 5) . "] \n";

Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>

Copyright (C) 2008 Jonathan Leto and Thierry Moisan
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.