Google
 

11/13/06

Use g++ and numerical recipes.

Here I show how to use numerical recipes (NR2). Now they have the latest version NR3 which is much better. You can find it on their website.

1. make a directory, called "bulbs" or whatever name you like.
2. make a include directory to store the head files, called "include", which resides in the directory "bulbs".
3. copy the head files: nr.h; nrtypes.h, nrtypes_lib.h, nrtypes_nr.h, nrutil.h, nrutil_nr.h, nrutil_val.h, print_array.h to the "include" directory.
4. Write the codes, say "bulbs.cpp", which will call the nr functions: expdev, sort1, and nrexit, ran1.
5. copy expdev.cpp, ran1.cpp, sort.cpp, to the directory which contains bulbs.cpp.
6. compile them by following commands (or you can write a makefile):
g++ -c -I ./include expdev.cpp
g++ -c -I ./include ran1.cpp
g++ -c -I ./include sort.cpp
g++ -c -I ./include nrexit.cpp
g++ -o bulbs bulbs.cpp expdev.o ran1.o sort.o nrexit.o
this should give the executable bulbs.

2 comments:

Anonymous said...

Short and Good tutorial

Anonymous said...

linux4research.blogspot.com; You saved my day again.