Use of the IMSL C Libraries on science -------------------------------------- To link the IMSL C libraries, first (from csh) source /usr/local/vni/ipt/bin/iptsetup.csh This will set up the necessary environmental variables. Your calling program should #include Then, CC -o $CFLAGS $LINK_CNL In $LINK_CNL there are apparently some libraries listed more than once; therefore a linker statement like "The shared object /usr/lib/xxxx did not resolve any symbols. You may want to remove it from your link line." may be returned. Just ignore it. Many IMSL C funtions have optional arguments. For such functions, the last argument is always a 0. Online help is available. The command is iptdoc (which will be in the paths set when you source iptsetup.csh) This program runs an X-window, so if you are running remotely, you will need the DISPLAY variable to be set, and xhost privileges given to science. Here are a couple of examples: To generate 5 Gaussian random numbers: #include #include void main() { int seed = 123457; int n_random = 5; float *r; imsl_random_seed_set (seed); r = imsl_f_random_normal (n_random, 0); printf ("The random Gaussians are %8.4f%8.4f%8.4f%8.4f%8.4f\n", r[0], r[1], r[2], r[3], r[4]); } To solve the linear system 3x_1 +2x_2 + x_3 & = & 11 x_1 +4x_2 - x_3 & = & 3 x_1 - x_2 + 2x_3 & = & 7 #include #include void main() { int n = 3; float *x; float a[] = {3.0, 2.0, 1.0, 1.0, 4.0, -1.0, 1.0, -1.0, 2.0}; float b[] = {11.0, 3.0, 7.0}; x = imsl_f_lin_sol_gen (n, a, b, 0); printf ("The solution is %10.4f%10.4f%10.4f\n", x[0], x[1], x[2]); }