The GNU Scientific Library (or GSL) is a software library for numerical computations in applied mathematics and science. The GSL is written in C (programming language), C; wrappers are available for other programming languages. The GSL is part of the GNU Project and is distributed under the GNU General Public License.
Project history
The GSL project was initiated in 1996 by physicists Mark Galassi and James Theiler of Los Alamos National Laboratory.
[GSL homepage](_blank)
They aimed at writing a modern replacement for widely used but somewhat outdated Fortran libraries such as Netlib. They carried out the overall design and wrote early modules; with that ready they recruited other scientists to contribute.
The "overall development of the library and the design and implementation of the major modules" was carried out by Brian Gough and Gerard Jungman.
Other major contributors were Jim Davies (cognitive scientist), Jim Davies, Reid Priedhorsky, M. Booth, and F. Rossi.
Version 1.0 was released in 2001. In the following years, the library expanded only slowly; as the documentation stated, the maintainers were more interested in stability than in additional functionality. Major version 1 ended with release 1.16 of July 2013; this was the only public activity in the three years 2012–2014.
Vigorous development resumed with publication of version 2.0 in October 2015. The latest version 2.7 was released in June 2021.
Example
The following example program calculates the value of the Bessel function for 5:
#include
#include
int main(void)
The example program has to be linked to the GSL library
upon compilation:
gcc $(gsl-config --cflags) example.c $(gsl-config --libs)
The output is shown below and should be correct to double-precision accuracy:
J0(5) = -1.775967713143382920e-01
Features
The software library provides facilities for:
Programming-language bindings
Since the GSL is written in C, it is straightforward to provide wrappers for other programming languages. Such wrappers currently exist for
* AMPL
* C++
[ccgsl: a C++ interface for the gnu Scientific Library](_blank)
[GSL-- C++ wrappers for GSL](_blank)
[GSLwrap: A C++ wrapper class for the GNU Scientific Library](_blank)
* Fortran
* Haskell (programming language), Haskell
[The hmatrix-special package, an interface to GSL special functions](_blank)
[The hmatrix-gsl package, a purely functional interface to selected numerical computations, internally implemented using GSL](_blank)
* Java (programming language), Java
* Julia (programming language), Julia
* Common Lisp (programming language), Common Lisp
* Ocaml
* Octave (programming language), Octave
* Perl Data Language
* Python (programming language), Python
* R (programming language), R
* Ruby (programming language), Ruby
C++ support
The GSL can be used in C++ classes, but not using pointers to member functions, because the type of ''pointer to member function'' is different from ''pointer to function''.
Pointers to member functions
. Instead, pointers to static functions have to be used. Another common workaround is using a Function object, functor.
C++ wrappers for GSL are available. Not all of these are regularly maintained. They do offer access to matrix and vector classes without the user having to use malloc and Free (programming), free functions. Some also offer support for also creating workspaces that behave like Smart pointer classes. Finally, there is (limited, as of April 2020) support for allowing the user to create classes to represent a parametrised function as a Function object, functor.
While not strictly wrappers, there are some C++ classes [o2scl Object-oriented Scientific Computing Library](_blank)
[yat](_blank)
that allow C++ users to use the Gnu Scientific Library with wrapper features.
See also
* List of numerical-analysis software
* List of numerical libraries
* Netlib
* ''Numerical Recipes''
Notes
References
External links
*
GSL Design Document
* Th
for R (programming language), an R wrapper for the special functions and quasi random number generators.
{{GNU
C (programming language) libraries
Free computer libraries
Free software programmed in C
GNU Project software, Scientific Library
Mathematical libraries
Numerical libraries
Numerical software
Articles with example C code