Fork me on GitHub

GSL

The GNU Scientific Library (GSL) is a collection of routines for numerical computing. The routines have been written from scratch in C. See here for the types of routines that the GSL provides.

Usage

The GSL library can be loaded using:

module load libs/gsl/2.4/gcc-6.2

Example

A example program that uses the GSL (taken from the GSL documentation):

#include <stdio.h>
#include <stdlib.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 EXIT_SUCCESS;
}

Build this using:

gcc -Wall -lgsl -lgslcblas -o test test.c

Then run using:

./test

which should print the following (correct to double-precision accuracy):

J0(5) = -1.775967713143382642e-01

NB generally, you may not need to compile using -lgslcblas depending on which GSL routines you are using.

Installation notes