[SCCN Home]

SCCN Lab Information

Computer System FAQ

How do I use the "Numerical Recipes" libraries?

The libraries from the book Numerical Recipes are installed under the the directory:

   /usr/common/pkgs/nr

The book has two versions for C++ and C. The book for C is available at http://www.nrbook.com/nr3/

To compile a program for C++, use the following syntax.

g++ -I/usr/local/include/recipes_cpp  -c myprog.cpp  -o myprog  -lrecipes_cpp

To compile a program for C, use the following syntax.

gcc -I/usr/local/include/recipes_c-ansi -c myprog.c -o myprog -lrecipes_c-ansi

NOTE: I believe you have to include as a minimum the file nr.h.

i.e.

#include "nr.h"

For more information, please check the test programs already written for C++ and C respectively.

/usr/common/pkgs/nr/recipes_cpp/demo/src

and

/usr/common/pkgs/nr/recipes_c-ansi/demo/src

The source code is under the directories:

/usr/common/pkgs/nr/recipes_cpp/recipes/*.cpp

and

/usr/common/pkgs/nr/recipes_c-ansi/recipes/*.c