.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.if !\nF .nr F 0
.if \nF>0 \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Math::GSL::Permutation 3pm"
.TH Math::GSL::Permutation 3pm "2016-10-07" "perl v5.24.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Math::GSL::Permutation \- functions for creating and manipulating permutations
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 8
\& use Math::GSL::Permutation qw/:all/;
\& my $permutation = Math::GSL::Permutation\->new(30); # allocate and initialize a permutation of size 30
\& my $length = $permutation\->length; # returns the length of the permutation object, here it is 30
\& gsl_permutation_swap($permutation\->raw, 2,7);
\& # the raw method is made to use the underlying permutation structure of the permutation object
\& my $value = $permutation\->get(2); # returns the third value (starting from 0) of the permutation
\& my @values = $permutation\->as_list; # returns all the values of the permutation
\& my @set = $permutation\->get([0,1,2,3]); # returns the four first values of the permutation
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Here is a list of all the functions included in this module :
.ie n .IP "gsl_permutation_alloc($n) \- return a newly allocated permutation of size $n" 4
.el .IP "gsl_permutation_alloc($n) \- return a newly allocated permutation of size \f(CW$n\fR" 4
.IX Item "gsl_permutation_alloc($n) - return a newly allocated permutation of size $n"
.PD 0
.ie n .IP "gsl_permutation_calloc($n) \- return a newly allocated permutation of size $n which is initialized to the identity" 4
.el .IP "gsl_permutation_calloc($n) \- return a newly allocated permutation of size \f(CW$n\fR which is initialized to the identity" 4
.IX Item "gsl_permutation_calloc($n) - return a newly allocated permutation of size $n which is initialized to the identity"
.ie n .IP "gsl_permutation_init($p) \- initialize the permutation $p to the identity i.e. (0,1,2, ..., n\-1)" 4
.el .IP "gsl_permutation_init($p) \- initialize the permutation \f(CW$p\fR to the identity i.e. (0,1,2, ..., n\-1)" 4
.IX Item "gsl_permutation_init($p) - initialize the permutation $p to the identity i.e. (0,1,2, ..., n-1)"
.ie n .IP "gsl_permutation_free($p) \- free all the memory use by the permutaion $p" 4
.el .IP "gsl_permutation_free($p) \- free all the memory use by the permutaion \f(CW$p\fR" 4
.IX Item "gsl_permutation_free($p) - free all the memory use by the permutaion $p"
.ie n .IP "gsl_permutation_memcpy($dest, $src) \- copy the permutation $src into the permutation $dest, the two permutations must have the same length and return 0 if the operation succeeded, 1 otherwise" 4
.el .IP "gsl_permutation_memcpy($dest, \f(CW$src\fR) \- copy the permutation \f(CW$src\fR into the permutation \f(CW$dest\fR, the two permutations must have the same length and return 0 if the operation succeeded, 1 otherwise" 4
.IX Item "gsl_permutation_memcpy($dest, $src) - copy the permutation $src into the permutation $dest, the two permutations must have the same length and return 0 if the operation succeeded, 1 otherwise"
.ie n .IP "gsl_permutation_fread($stream, $p) \- This function reads into the permutation $p from the open stream $stream (opened with the gsl_fopen function from the Math::GSL module) in binary format. The permutation $p must be preallocated with the correct length since the function uses the size of $p to determine how many bytes to read. The function returns 1 if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture." 4
.el .IP "gsl_permutation_fread($stream, \f(CW$p\fR) \- This function reads into the permutation \f(CW$p\fR from the open stream \f(CW$stream\fR (opened with the gsl_fopen function from the Math::GSL module) in binary format. The permutation \f(CW$p\fR must be preallocated with the correct length since the function uses the size of \f(CW$p\fR to determine how many bytes to read. The function returns 1 if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture." 4
.IX Item "gsl_permutation_fread($stream, $p) - This function reads into the permutation $p from the open stream $stream (opened with the gsl_fopen function from the Math::GSL module) in binary format. The permutation $p must be preallocated with the correct length since the function uses the size of $p to determine how many bytes to read. The function returns 1 if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture."
.ie n .IP "gsl_permutation_fwrite($stream, $p) \- This function writes the elements of the permutation $p to the stream $stream (opened with the gsl_fopen function from the Math::GSL module) in binary format. The function returns 1 if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures." 4
.el .IP "gsl_permutation_fwrite($stream, \f(CW$p\fR) \- This function writes the elements of the permutation \f(CW$p\fR to the stream \f(CW$stream\fR (opened with the gsl_fopen function from the Math::GSL module) in binary format. The function returns 1 if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures." 4
.IX Item "gsl_permutation_fwrite($stream, $p) - This function writes the elements of the permutation $p to the stream $stream (opened with the gsl_fopen function from the Math::GSL module) in binary format. The function returns 1 if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures."
.ie n .IP "gsl_permutation_fscanf($stream, $p) \- This function reads formatted data from the stream $stream (opened with the gsl_fopen function from the Math::GSL module) into the permutation $p. The permutation $p must be preallocated with the correct length since the function uses the size of $p to determine how many numbers to read. The function returns 1 if there was a problem reading from the file." 4
.el .IP "gsl_permutation_fscanf($stream, \f(CW$p\fR) \- This function reads formatted data from the stream \f(CW$stream\fR (opened with the gsl_fopen function from the Math::GSL module) into the permutation \f(CW$p\fR. The permutation \f(CW$p\fR must be preallocated with the correct length since the function uses the size of \f(CW$p\fR to determine how many numbers to read. The function returns 1 if there was a problem reading from the file." 4
.IX Item "gsl_permutation_fscanf($stream, $p) - This function reads formatted data from the stream $stream (opened with the gsl_fopen function from the Math::GSL module) into the permutation $p. The permutation $p must be preallocated with the correct length since the function uses the size of $p to determine how many numbers to read. The function returns 1 if there was a problem reading from the file."
.ie n .IP "gsl_permutation_fprintf($stream, $p, $format) \- This function writes the elements of the permutation $p line-by-line to the stream $stream (opened with the gsl_fopen function from the Math::GSL module) using the format specifier $format, which should be suitable. ""%zu\en"" is a suitable format. The function returns 1 if there was a problem writing to the file." 4
.el .IP "gsl_permutation_fprintf($stream, \f(CW$p\fR, \f(CW$format\fR) \- This function writes the elements of the permutation \f(CW$p\fR line-by-line to the stream \f(CW$stream\fR (opened with the gsl_fopen function from the Math::GSL module) using the format specifier \f(CW$format\fR, which should be suitable. ``%zu\en'' is a suitable format. The function returns 1 if there was a problem writing to the file." 4
.IX Item "gsl_permutation_fprintf($stream, $p, $format) - This function writes the elements of the permutation $p line-by-line to the stream $stream (opened with the gsl_fopen function from the Math::GSL module) using the format specifier $format, which should be suitable. %zun is a suitable format. The function returns 1 if there was a problem writing to the file."
.ie n .IP "gsl_permutation_size($p) \- return the size of the permutation $p" 4
.el .IP "gsl_permutation_size($p) \- return the size of the permutation \f(CW$p\fR" 4
.IX Item "gsl_permutation_size($p) - return the size of the permutation $p"
.IP "gsl_permutation_data" 4
.IX Item "gsl_permutation_data"
.ie n .IP "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" 4
.el .IP "gsl_permutation_get($p, \f(CW$i\fR) \- return the \f(CW$i\fR\-th element of the permutation \f(CW$p\fR, return 0 if \f(CW$i\fR is outside the range of 0 to n\-1" 4
.IX Item "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"
.ie n .IP "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 succeeded, 1 otherwise" 4
.el .IP "gsl_permutation_swap($p, \f(CW$i\fR, \f(CW$j\fR) \- exchange the \f(CW$i\fR\-th position and the \f(CW$j\fR\-th position of the permutation \f(CW$p\fR and return 0 if the operation succeeded, 1 otherwise" 4
.IX Item "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 succeeded, 1 otherwise"
.ie n .IP "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" 4
.el .IP "gsl_permutation_valid($p) \- return 0 if the permutation \f(CW$p\fR is valid (if the n elements contain each of the numbers 0 to n\-1 once and only once), 1 otherwise" 4
.IX Item "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"
.ie n .IP "gsl_permutation_reverse($p) \- reverse the elements of the permutation $p" 4
.el .IP "gsl_permutation_reverse($p) \- reverse the elements of the permutation \f(CW$p\fR" 4
.IX Item "gsl_permutation_reverse($p) - reverse the elements of the permutation $p"
.ie n .IP "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" 4
.el .IP "gsl_permutation_inverse($inv, \f(CW$p\fR) \- compute the inverse of the permutation \f(CW$p\fR, storing it in \f(CW$inv\fR and return 0 if the operation succeeded, 1 otherwise" 4
.IX Item "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"
.ie n .IP "gsl_permutation_next($p) \- advance the permutation $p to the next permutation in lexicographic order and return 0 if the operation succeeded, 1 otherwise" 4
.el .IP "gsl_permutation_next($p) \- advance the permutation \f(CW$p\fR to the next permutation in lexicographic order and return 0 if the operation succeeded, 1 otherwise" 4
.IX Item "gsl_permutation_next($p) - advance the permutation $p to the next permutation in lexicographic order and return 0 if the operation succeeded, 1 otherwise"
.ie n .IP "gsl_permutation_prev($p) \- step backward from the permutation $p to the previous permutation in lexicographic order and return 0 if the operation succeeded, 1 otherwise" 4
.el .IP "gsl_permutation_prev($p) \- step backward from the permutation \f(CW$p\fR to the previous permutation in lexicographic order and return 0 if the operation succeeded, 1 otherwise" 4
.IX Item "gsl_permutation_prev($p) - step backward from the permutation $p to the previous permutation in lexicographic order and return 0 if the operation succeeded, 1 otherwise"
.ie n .IP "gsl_permutation_mul($p, $pa, $pb) \- combine the two permutation $pa and $pb into a single permutation $p and return 0 if the operation succeeded, 1 otherwise" 4
.el .IP "gsl_permutation_mul($p, \f(CW$pa\fR, \f(CW$pb\fR) \- combine the two permutation \f(CW$pa\fR and \f(CW$pb\fR into a single permutation \f(CW$p\fR and return 0 if the operation succeeded, 1 otherwise" 4
.IX Item "gsl_permutation_mul($p, $pa, $pb) - combine the two permutation $pa and $pb into a single permutation $p and return 0 if the operation succeeded, 1 otherwise"
.ie n .IP "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 succeeded, 1 otherwise" 4
.el .IP "gsl_permutation_linear_to_canonical($q, \f(CW$p\fR) \- compute the canonical form the permutation \f(CW$p\fR and store it in \f(CW$q\fR and return 0 if the operation succeeded, 1 otherwise" 4
.IX Item "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 succeeded, 1 otherwise"
.ie n .IP "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 succeeded, 1 otherwise" 4
.el .IP "gsl_permutation_canonical_to_linear($p, \f(CW$q\fR) \- convert a canonical permutation \f(CW$q\fR back into linear form and store it in \f(CW$p\fR and return 0 if the operation succeeded, 1 otherwise" 4
.IX Item "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 succeeded, 1 otherwise"
.ie n .IP "gsl_permutation_inversions($p) \- return the number of inversions in the permutation $p" 4
.el .IP "gsl_permutation_inversions($p) \- return the number of inversions in the permutation \f(CW$p\fR" 4
.IX Item "gsl_permutation_inversions($p) - return the number of inversions in the permutation $p"
.ie n .IP "gsl_permutation_linear_cycles($p) \- return the number of cycles in the permutation $p, given a linear form" 4
.el .IP "gsl_permutation_linear_cycles($p) \- return the number of cycles in the permutation \f(CW$p\fR, given a linear form" 4
.IX Item "gsl_permutation_linear_cycles($p) - return the number of cycles in the permutation $p, given a linear form"
.ie n .IP "gsl_permute_vector_int_inversegsl_permutation_canonical_cycles($p) \- return the number of cycles in the permutation $p, given a canonical form" 4
.el .IP "gsl_permute_vector_int_inversegsl_permutation_canonical_cycles($p) \- return the number of cycles in the permutation \f(CW$p\fR, given a canonical form" 4
.IX Item "gsl_permute_vector_int_inversegsl_permutation_canonical_cycles($p) - return the number of cycles in the permutation $p, given a canonical form"
.IP "gsl_permute" 4
.IX Item "gsl_permute"
.IP "gsl_permute_inverse" 4
.IX Item "gsl_permute_inverse"
.IP "gsl_permute_int" 4
.IX Item "gsl_permute_int"
.IP "gsl_permute_int_inverse" 4
.IX Item "gsl_permute_int_inverse"
.IP "gsl_permute_vector" 4
.IX Item "gsl_permute_vector"
.IP "gsl_permute_vector_inverse" 4
.IX Item "gsl_permute_vector_inverse"
.IP "gsl_permute_vector_int" 4
.IX Item "gsl_permute_vector_int"
.PD
.PP
.Vb 5
\& 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 available functions of the module.
\& Other tags are also available, here is a complete list of all tags for this module.
\&For more information on the functions, we refer you to the GSL offcial documentation:
\&L
.Ve
.SH "EXAMPLES"
.IX Header "EXAMPLES"
.Vb 12
\& 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 "] \en";
\& print "We\*(Aqll then swap the first and last elements of the permutation...\en";
\& 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 "] \en";
\&
\&
\& 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) . "] \en";
\& 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) . "] \en";
\& 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) . "] \en";
.Ve
.SH "AUTHORS"
.IX Header "AUTHORS"
Jonathan \*(L"Duke\*(R" Leto and Thierry Moisan
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright (C) 2008\-2011 Jonathan \*(L"Duke\*(R" Leto and Thierry Moisan
.PP
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.