Child pages
  • GNU Scientific Library
Skip to end of metadata
Go to start of metadata

Using the GNU Scientific Library

The GNU Scientific Library is a numerical library for C and C++ programmers. A simple matrix multiplication program, and an associated submit script are as follows:

 

Categories for this softwareMath Libraries
What is GSLThe GNU Scientific Library (or GSL) is a software library for numerical computations in applied mathematics and science. The GSL is written in C; wrappers are available for other programming languages.  http://en.wikipedia.org/wiki/GNU_Scientific_Library
How to useGSL is free to use. The GSL is part of the GNU Project[1] and is distributed under the GNU General Public License.

Sample Code

SRC=gsl.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;
}
COMPILE
module load gsl
gcc -o gsl.exe $CFLAGS $LDFLAGS -lgsl -lgslcblas -lm gsl.c

 

 

SHELL SCRIPT
#!/bin/sh
#$ -S /bin/sh
#$ -cwd
module load gsl
~/bin/gsl.exe
  • No labels