---
name: "Math::GSL"
section: "3pm"
platform: "linux"
package: "libmath-gsl-perl"
version: "0.45-2+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Math::GSL"
---

# Math::GSL(3pm)

Perl interface to the GNU Scientific Library (GSL)

## NAME

Math::GSL - Perl interface to the GNU Scientific Library (GSL)

## VERSION

Version 0.45

## SYNOPSIS

```
    use Math::GSL::Matrix;
    my $matrix = Math::GSL::Matrix->new(5,5);   # 5x5 zero matrix
    # note that columns and rows are zero-based
    $matrix->set_col(0, [1..5])                 # set *first* column to 1,2,3,4,5
           ->set_row(2, [5..9]);                # set *third* column to 5,6,7,8,9
    my @matrix = $matrix->as_list;              # matrix as Perl list
    my $gsl_matrix = $matrix->raw;              # underlying GSL object
    use Math::GSL::RNG;
    my $rng = Math::GSL::RNG->new;
    my @random_numbers = $rng->get(1000);
    use Math::GSL::Deriv qw/:all/;
    my $function = sub { my $x=shift; sin($x**2) };
    my ($status,$val,$err) = gsl_deriv_central($function, 5, 0.01 );
    use Math::GSL qw/gsl_version/;
    # get a version object for the version of the underlying GSL library,
    # which will stringify to a version number
    my $gsl_version = gsl_version();
```

Each GSL subsystem has its own module. For example, the random number generator subsystem is Math::GSL::RNG. Many subsystems have a more Perlish and object-oriented frontend which can be used, as the above example shows. The raw GSL object is useful for using the low-level GSL functions, which in the case of the Matrix subsystem, would be of the form gsl\_matrix\_\* . Each module has further documentation about the low-level C functions as well as using the more intuitive (but slightly slower) object-oriented interface.

## SUBSYSTEMS

Math::GSL::BLAS            - Linear Algebra Functions

Math::GSL::BSpline         - BSplines

Math::GSL::CBLAS           - Linear Algebra Functions

Math::GSL::CDF             - Cumulative Distribution Functions

Math::GSL::Chebyshev       - Chebyshev Polynomials

Math::GSL::Combination     - Combinatoric Functions

Math::GSL::Complex         - Complex Numbers

Math::GSL::Const           - Various Constants

Math::GSL::DHT             - Discrete Hankel Transforms

Math::GSL::Deriv           - Numerical Derivative

Math::GSL::Eigen           - Eigenvalues and Eigenvectors

Math::GSL::Errno           - Error Handling

Math::GSL::FFT             - Fast Fourier Transform

Math::GSL::Fit             - Curve Fitting

Math::GSL::Heapsort        - Sorting Heaps

Math::GSL::Histogram       - Histograms

Math::GSL::Histogram2D     - 2D Histograms

Math::GSL::Integration     - Numerical Integration

Math::GSL::Interp          - Interpolation

Math::GSL::Linalg          - Linear Algebra

Math::GSL::Machine         - Machine Specific Information

Math::GSL::Matrix          - NxM Matrices

Math::GSL::Min             - Minimization

Math::GSL::Monte           - Monte Carlo Integrations

Math::GSL::Multifit        - Multivariable Fitting

Math::GSL::Multimin        - Multivariable Minimization

Math::GSL::Multiroots      - Muiltvariable Root Finding

Math::GSL::NTuple          - N Tuples

Math::GSL::ODEIV           - Ordinary Differential Equation Solvers (Initial Value Problems)

Math::GSL::Permutation     - Permutations

Math::GSL::Poly            - Polynmials

Math::GSL::PowInt          - Integer Power Functions

Math::GSL::QRNG            - Quasi-Random Number Generators

Math::GSL::RNG             - Random Number Generators

Math::GSL::Randist         - Random Number Distributions

Math::GSL::Roots           - Root Finding Algorithms

Math::GSL::Rstat           - Running Statistics

Math::GSL::SF              - Special Functions

Math::GSL::Siman           - Simulated Annealing

Math::GSL::Sort            - Sorting

Math::GSL::SparseMatrix    - Sparse Matrices

Math::GSL::Spline          - Splines

Math::GSL::Statistics      - Statistics Functions

Math::GSL::Sum             - Summation

Math::GSL::Sys             - System utility functions

Math::GSL::Vector          - N-dimensional Vectors

Math::GSL::Wavelet         - Basic Wavelets

Math::GSL::Wavelet2D       - 2D Wavelets

## AUTHORS

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

## BUGS

This software is still in active development, we appreciate your detailed bug reports and documentation patches. Please report any bugs or feature requests to the authors directly.

## COMPILING ISSUES

Some operating system configurations will make the compilation of Math::GSL fail. One common problem that happens on RedHat Linux (RHEL) and CentOS looks like this:

```
    Error:  Can't load '/usr/src/misc/perl-package/Math-GSL-0.20/blib/arch/auto/Math/GSL/Errno/Errno.so'
    for module Math::GSL::Errno: /usr/src/misc/perl-package/Math-GSL-0.20/blib/arch/auto/Math/GSL/Errno/Errno.so:
    cannot restore segment prot after reloc: Permission denied at /usr/lib/perl5/5.10.0/i386-linux-thread-multi/DynaLoader.pm line 203.
    #  at blib/lib/Math/GSL/Errno.pm line 10
```

This is due to the SE Linux setting being set to "enforcing". To Temporarily disable enforcement on a running system:

```
    /usr/sbin/setenforce 0
```

To permanently disable enforcement during a system startup change "enforcing" to "disabled" in ''/etc/selinux/config'' and reboot.

## SUPPORT

You can find documentation for this module with the perldoc command.

```
    perldoc Math::GSL
```

or online at \<http://leto.net/code/Math-GSL/\>

- •

  AnnoCPAN: Annotated CPAN documentation

  \<http://annocpan.org/dist/Math::GSL\>

- •

  CPAN Ratings

  \<http://cpanratings.perl.org/d/Math::GSL\>

- •

  Search CPAN

  \<http://search.cpan.org/dist/Math::GSL\>

## DEVELOPMENT

If you would like the help develop Math::GSL, visit us on Github \<https://github.com/leto/math--gsl\> and fork, send Pull Requests and/or create issues.

To view the latest source code online, go to \<http://github.com/leto/math--gsl/tree/master\>.

The latest version of Git can be found at \<http://git-scm.com\> .

## ACKNOWLEDGEMENTS

Thanks to PDX.pm, The Perl Foundation and everyone at Google who makes the Summer of Code happen each year. You rock.

## DEDICATION

This Perl module is dedicated in memory of Nick Ing-Simmons.

## COPYRIGHT & LICENSE

Copyright (C) 2008-2024 Jonathan "Duke" Leto, Thierry Moisan all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
