Help language development. Donate to The Perl Foundation

Math-Libgsl-Permutation-0.0.6/

Math::Libgsl::Permutation - An interface to libgsl, the Gnu Scientific Library - Permutations.

use Math::Libgsl::Raw::Permutation :ALL; use Math::Libgsl::Permutation;

Math::Libgsl::Permutation provides an interface to the permutation functions of libgsl, the GNU Scientific Library.

This package provides both the low-level interface to the C library (Raw) and a more comfortable interface layer for the Raku programmer.

The constructor accepts one parameter: the number of elements in the permutation; it can be passed as a Pair or as a single value. The permutation object is already initialized to the identity (0, 1, 2 … $elems - 1).

This method initialize the permutation object to the identity and returns **self**.

This method copies the permutation **$src** into the current permutation object and returns **self**.

This method returns the permutation value at position **$elem**.

This method returns a Seq of all the elements of the current permutation.

This method swamps two elements of the current permutation object and returns **self**.

This method returns the size of the current permutation object.

This method checks whether the current permutation is valid: the n elements should contain each of the numbers 0 to n - 1 once and only once.

This method reverses the order of the elements of the current permutation object.

This method computes the inverse of the current permutation and stores the result into **$dst**.

These functions advance or step backwards the permutation and return **self**, useful for method chaining.

These functions advance or step backwards the permutation and return a Bool: **True** if successful or **False** if there's no more permutation to produce.

This method applies the current permutation to the **@data** array with stride **$stride**.

This method applies the inverse of the current permutation to the **@data** array with stride **$stride**.

This method applies the current permutation to the **@data** array array of Complex with stride **$stride**.

This method applies the inverse of the current permutation to the **@data** array of Complex with stride **$stride**.

This method applies the current permutation to the **@data** array array of Complex with stride **$stride**, trating the numbers as single precision floats.

This method applies the inverse of the current permutation to the **@data** array of Complex with stride **$stride**, trating the numbers as single precision floats.

This method applies the permutation to a Vector object and returns the Vector object itself. As in the case of the Vector object, this method is available for all the supported data type, so we have

permute-vector-num32

permute-vector-int32

permute-vector-uint32

…and so on.

This method applies the inverse permutation to a Vector object and returns the Vector object itself. As in the case of the Vector object, this method is available for all the supported data type, so we have

permute-vector-inv-num32

permute-vector-inv-int32

permute-vector-inv-uint32

…and so on.

permute-matrix-num32

permute-matrix-int32

permute-matrix-uint32

…and so on.

This method writes the permutation data to a file.

This method reads the permutation data from a file. The permutation must be of the same size of the one to be read.

This method writes the permutation data to a file, using the format specifier.

This method reads the permutation data from a file. The permutation must be of the same size of the one to be read.

This method combines the current permutation with the permutation **$p2**, stores the result into **$dst** and returns **self**.

This method computes the canonical form of the current permutation, stores the result into **$dst** and returns **self**.

This method computes the linear form of the current permutation, stores the result into **$dst** and returns **self**.

This method counts the number of inversions in the current permutation.

This method counts the number of cycles in the current permutation given in linear form.

This method counts the number of cycles in the current permutation given in canonical form.

For more details on libgsl see https://www.gnu.org/software/gsl/. The excellent C Library manual is available here https://www.gnu.org/software/gsl/doc/html/index.html, or here https://www.gnu.org/software/gsl/doc/latex/gsl-ref.pdf in PDF format.

This module requires the libgsl library to be installed. Please follow the instructions below based on your platform:

```
sudo apt install libgsl23 libgsl-dev libgslcblas0
```

That command will install libgslcblas0 as well, since it's used by the GSL.

libgsl23 and libgslcblas0 have a missing symbol on Ubuntu 18.04. I solved the issue installing the Debian Buster version of those three libraries:

http://http.us.debian.org/debian/pool/main/g/gsl/libgslcblas0_2.5+dfsg-6_amd64.deb

http://http.us.debian.org/debian/pool/main/g/gsl/libgsl23_2.5+dfsg-6_amd64.deb

http://http.us.debian.org/debian/pool/main/g/gsl/libgsl-dev_2.5+dfsg-6_amd64.deb

To install it using zef (a module management tool):

```
$ zef install Math::Libgsl::Permutation
```

Fernando Santagata [email protected]

Copyright 2020 Fernando Santagata

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.