GSL – GNU Scientific Library

I’ve talked about IMSL on my pyIMSL post, which is a commercial scientific library. There is a GNU version of IMSL, GSL. Finding GSL is the courtesy of Jiangang, who was the author of the poster that I most liked from the 212th AAS, (see My first AAS. V. measurement error and EM and his comment.)

From the Introduction:

The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. It is free software under the GNU General Public License.

The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite.

This can save your time, effort, and complexity of your C/C++ code (instead of coding on your own, you can call functions in the scientific library, which makes your code compact and decipherable).

[Added] See my pyIMSL where I made links to IMSL manuals. I have no guts to print Fortran and C/C++ versions for the sake of our earth.

5 Comments
  1. Alex:

    I have had excellent experiences with GSL. There are interfaces for it available for R (http://cran.r-project.org/web/packages/gsl/index.html) and Python (http://pygsl.sourceforge.net/). In my experience, these are especially useful when there is some less-than-common function that one needs to approximate numerically (for example, the exponential integral). My personal favorite routines to use when programming in C/C++ are:
    FFT
    Simulate annealing
    Monte Carlo integration
    Multidimensional optimization

    (and yes, I am enough of a nerd to have favorite numerical libraries)

    10-23-2008, 10:37 pm
  2. victor:

    As you look like a python guy, here’s a good alternative – scipy. It basically incorporates and further extends most gsl into python module with matlab style syntaxis. Fast and simple – actually I like it better than matlab :)

    10-24-2008, 3:49 am
  3. hlee:

    Well, in terms of languages, although I’m not a computer person and I never will be, I started with Basic, fortran77/90/95, and C/C++, then Splus, Minitab, SPSS, Arc, Gauss, SAS, and R came along from the statistics side, then MATLAB from engineering courses, and then Mathematica and Maple from computational physics. Which ever libraries and modules make a life easy, I tried to incorporate them to accelerate and to modulize the program. Different from your understanding, it’s been a few days I get to know python although a few years back I tried it, so I’m not python person. Additionally, PHP, HTML, XHTML, CSS are something came along because of this slog and don’t forget there are astronomical systems/packages/softwares/tools like IRAF, IDL, AIPS, mongo/supermongo that I learned. The main reason of learning python is because of ciao, another astronomical data analysis system. I’ve tried XSPEC and it seems like I should try ISIS. I have no preference but I wish I could stick to just one. Currently scipy module is invisible from ciao/sherpa (numpy can be imported) and looking for ways to add it within ciao/sherpa.

    BTW, it’s good to have additional information. Thanks Alex! used IMSL some years back when GNU projects were not popular like nowadays and I couldn’t understand why people do not go beyond Numerical Recipes when both are commercial (probably, it’s because of price? but I think it’s cheaper than IDL).

    Anyway, I’m happy that so far I don’t have to learn java nor ajax nor Ruby. Oh and perhaps it’ll be interesting to find matching GPL softwares to commonly used ones. So far, Octave, SciLab-Matlab, GSL – IMSL, R – Splus, GDL – IDL are the ones I can think of.

    p.s. One of my [ArXiv] posts has a paper about ISIS (click here).

    10-24-2008, 11:25 am
  4. Jiangang:

    GSL in C/C++/Fortran is very good for people who need high efficiency computation, for example, if you are handling terabytes/gigabyes scale data, or doing high dimensional parameter fitting to complicated models, such as those cosmological models. Personally, I prefer C++ because most of my work need high efficiency. Especially, I think the ultimate bottle neck lies in we cannot increase the speed of computer the same pace as the increase of data(you cannot make electrons move faster than light). While, a combination of C++ and Python should be enough for most need in scientific research.

    A even better(in the sense of efficiency) one is the Intel Math Kernel Library (google it for more comparisons), which, unfortunately, is not free.

    10-26-2008, 4:54 pm
  5. Alex:

    I personally favor a combination of Python, C++, and R for statistical work. I used to work with Matlab, but NumPy + SciPy have replaced it for me (free as in speech & beer, and they play well with other applications). With GSL & C++, plus RPy and the other APIs, it’s pretty straightforward to build fast, usable tools without too much “nitty-gritty” coding (aka, C++).

    10-27-2008, 1:44 pm
Leave a comment