Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
GNU Scientific Library
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Library for numerical analysis in C and C++}} {{Infobox software | repo = {{URL|http://ftpmirror.gnu.org/gsl/}} | name = GNU Scientific Library | title = | logo = | logo caption = | screenshot = | caption = | collapsible = | author = [[Mark Galassi]], James Theiler, Brian Gough, Gerard Jungman and many others | developer = [[GNU Project]] | released = {{Start date and age|1996|05}} | discontinued = | latest release version = {{wikidata|property|preferred|references|edit|Q1486247|P348|P548=Q2804309}} | latest release date = {{wikidata|qualifier|preferred|single|Q1486247|P348|P548=Q2804309|P577}} | latest preview version = {{wikidata|property|preferred|references|edit|Q1486247|P348|P548=Q51930650}} | latest preview date = {{wikidata|qualifier|preferred|single|Q1486247|P348|P548=Q51930650|P577}} | programming language = [[C (programming language)|C]] | operating system = | platform = | size = | language = | genre = [[List of numerical libraries|Numerical library]] | license = 2007: [[GNU General Public License|GPL-3.0-or-later]]{{efn|GPL-3.0-or-later since 2007-07-02.}}<br />1996: [[GNU General Public License|GPL-2.0-or-later]]{{efn|GPL-2.0-or-later from 1996-07-08 until 2007-07-02.}} | alexa = | website = {{URL|https://www.gnu.org/software/gsl/}} }} 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]]<ref>{{Cite web|url=http://directory.fsf.org/GNU/|title = GNU - Free Software Directory}}</ref> 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]].<ref name="GSL homepage">[https://www.gnu.org/software/gsl/ GSL homepage].</ref> They aimed at writing a modern replacement for widely used but somewhat outdated [[Fortran]] libraries such as [[Netlib]].<ref>[https://www.gnu.org/software/gsl/design/gsl-design.html#SEC1 GSL design document].</ref> 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.<ref name="GSL homepage"/> Other major contributors were [[Jim Davies (cognitive scientist)|Jim Davies]], Reid Priedhorsky, M. Booth, and F. Rossi.<ref name="GSL homepage"/> 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, which included user contributed patches. The latest version 2.8 was released in May 2024. == Example == The following example program calculates the value of the [[Bessel function]] of the first kind and order zero for 5:<ref>[https://www.gnu.org/software/gsl/doc/html/usage.html#an-example-program Using the Library. An Example Program]. GSL documentation.</ref> <syntaxhighlight lang="c"> #include <stdio.h> #include <gsl/gsl_sf_bessel.h> int main(void) { double x = 5.0; double y = gsl_sf_bessel_J0(x); printf("J0(%g) = %.18e\n", x, y); return 0; } </syntaxhighlight> The example program has to be linked to the GSL library upon compilation: <syntaxhighlight lang="console"> $ gcc $(gsl-config --cflags) example.c $(gsl-config --libs) </syntaxhighlight> The output is shown below and should be correct to [[double-precision]] accuracy: <syntaxhighlight lang="output"> J0(5) = -1.775967713143382920e-01 </syntaxhighlight> == Features == The software library provides facilities for: {{columns-list|colwidth=24em| * [[Elementary function|Basic mathematical functions]] * [[Complex number]]s * [[Polynomial]]s * [[B-spline]]s * [[Special functions]] * [[Vector space|Vectors]] and [[Matrix (mathematics)|matrices]] * [[Permutation]]s * [[Combination]]s * [[Multiset]]s * [[Sorting]] * [[Basic Linear Algebra Subprograms|BLAS]] * [[Linear algebra]] * [[Eigensystem]]s * [[Fast Fourier transform]]s * [[Numerical integration]] (based on [[QUADPACK]]) * [[Random number generator|Random number generation]] * [[Quasi-random sequences]] * [[probability distribution|Random number distributions]] * [[Statistics]] * [[Histogram]]s * [[N-tuple]]s * [[Monte Carlo integration]] * [[Simulated annealing]] * [[Ordinary differential equation]]s * [[Interpolation]] * [[Numerical differentiation]] * [[Chebyshev approximation]]s * [[Series acceleration]] * Discrete [[Hankel transform]] * [[Root-finding algorithm|Root finding]] in one and multiple dimensions * [[Optimization (mathematics)|Minimization]] in one and multiple dimensions * [[least squares|Least-squares fitting]] * [[Levenberg–Marquardt algorithm|Nonlinear least-squares fitting]] * [[Physical constants]] * [[IEEE floating-point arithmetic]] * [[Discrete wavelet transform]] }} === 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]]<ref>[https://ampl.github.io/amplgsl/ AMPL bindings for the GNU Scientific Library] {{Webarchive|url=https://web.archive.org/web/20211028035110/https://ampl.github.io/amplgsl/ |date=2021-10-28 }}.</ref> * [[C++]]<ref name="ccgsl">[http://ccgsl.sourceforge.net/ ccgsl: a C++ interface for the GNU Scientific Library]; </ref><ref name="gslmm">[http://cholm.home.cern.ch/cholm/misc/#gslmm GSL-- C++ wrappers for GSL] {{Webarchive|url=https://web.archive.org/web/20150129094320/http://cholm.home.cern.ch/cholm/misc/#gslmm |date=2015-01-29 }};</ref><ref name="gslwrap">[http://gslwrap.sourceforge.net/ GSLwrap: A C++ wrapper class for the GNU Scientific Library];</ref><ref name="gslcpp">[https://github.com/tevaughan/gslcpp/ gslcpp: A Header-Only, Modern C++-Library Wrapping the GNU Scientific Library].</ref> * [[Fortran]]<ref>[https://doku.lrz.de/display/PUBLIC/FGSL+-+A+Fortran+interface+to+the+GNU+Scientific+Library FGSL - A Fortran interface to the GNU Scientific Library].</ref> * [[Haskell]]<ref name="hmatrix-special">[https://hackage.haskell.org/package/hmatrix-special The hmatrix-special package, an interface to GSL special functions].</ref><ref name="hmatrix-gsl">[https://hackage.haskell.org/package/hmatrix-gsl The hmatrix-gsl package, a purely functional interface to selected numerical computations, internally implemented using GSL].</ref> * [[Java (programming language)|Java]]<ref>[https://github.com/bytedeco/javacpp-presets/tree/master/gsl JavaCPP Presets for GSL].</ref> * [[Julia (programming language)|Julia]]<ref>[https://github.com/JuliaMath/GSL.jl Julia interface to GSL].</ref> * [[Common Lisp]]<ref>[http://common-lisp.net/project/gsll/ GSLL, GNU Scientific Library for Lisp].</ref> * [[OCaml]]<ref>[https://mmottl.github.io/gsl-ocaml/ gsl-ocaml: OCaml bindings to the GSL].</ref> * [[Octave (programming language)|Octave]] * [[Perl Data Language]] * [[Python (programming language)|Python]]<ref>[http://pygsl.sourceforge.net/#pygsl Python interface for GNU Scientific Library].</ref> * [[R (programming language)|R]]<ref>[https://cran.r-project.org/web/packages/RcppGSL/index.html RcppGSL: 'Rcpp' Integration for 'GNU GSL' Vectors and Matrices].</ref><ref>[https://cran.r-project.org/web/packages/gsl/index.html gsl: wrapper for the Gnu Scientific Library].</ref> * [[Ruby (programming language)|Ruby]]<ref>[https://rubygems.org/gems/rb-gsl rb-gsl: Ruby/GSL is a Ruby interface to the GNU Scientific Library, for numerical computing with Ruby].</ref> * [[Rust (programming language)| Rust]]<ref>[https://docs.rs/GSL/6.0.0/rgsl/ rust-gsl: A Rust binding for the GSL library (the GNU Scientific Library).]</ref> === 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''.<ref>[http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.1 Pointers to member functions]. {{webarchive|url=https://web.archive.org/web/20041013202445/http://www.parashift.com/c++-faq-lite/pointers-to-members.html |date=2004-10-13 }}.</ref> Instead, pointers to static functions have to be used. Another common workaround is using a [[Function object|functor]]. C++ wrappers for GSL are available.<ref name="ccgsl"/><ref name="gslmm"/><ref name="gslwrap"/><ref name="gslcpp"/> Not all of these are regularly maintained. They do offer access to matrix and vector classes without having to use GSL's interface to [[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 parameterised function as a [[Function object|functor]]. While not strictly wrappers, there are some C++ classes <ref name="osscl">[https://neutronstars.utk.edu/code/o2scl/html/index.html o2scl Object-oriented Scientific Computing Library]; </ref><ref name="yat">[https://web.archive.org/web/20101103060841/http://dev.thep.lu.se/yat/ yat].</ref> that allow C++ users to use the Gnu Scientific Library with wrapper features. ==See also== {{Portal|Free and open-source software}} {{commons}} * [[List of numerical-analysis software]] * [[List of numerical libraries]] * [[Netlib]] * ''[[Numerical Recipes]]'' ==Notes== {{notelist}} ==References== {{Reflist}} ==External links== * {{Official website|https://www.gnu.org/software/gsl/}} * [https://doi.org/10.5281/zenodo.3818202 GSL Design Document] * The [https://cran.r-project.org/web/packages/gsl/index.html '''gsl''' package] for [[R (programming language)]], an R wrapper for the special functions and quasi random number generators. * [https://web.archive.org/web/20120427034149/http://www.floss4science.com/the-gnu-scientific-library-gsl-mark-galassi/ FLOSS FOR SCIENCE interview] with Mark Galassi on the history of GSL. {{GNU}} [[Category:C (programming language) libraries]] [[Category:Free computer libraries]] [[Category:Free software programmed in C]] [[Category:GNU Project software|Scientific Library]] [[Category:Mathematical libraries]] [[Category:Numerical libraries]] [[Category:Numerical software]] [[Category:Articles with example C code]] [[Category:Software using the GNU General Public License]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite web
(
edit
)
Template:Columns-list
(
edit
)
Template:Commons
(
edit
)
Template:GNU
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Main other
(
edit
)
Template:Notelist
(
edit
)
Template:Official website
(
edit
)
Template:Portal
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Template other
(
edit
)
Template:Webarchive
(
edit
)