At this time IMSL is installed on the SCF and on the RCF.
Requirements
To use any of the IMSL routines, you must write a program in FORTRAN or C (or some other language) to call the desired routine. You must then link the program source code to the IMSL library during compilation.
The following setup is required in order to use the IMSL subroutines in the RCF or SCF:
Host Command aludra
almaakTo source the current IMSL library:
source /usr/usc/imsl/default/setup.csh
To source the setup files for the compilers:
source /usr/spac/sparcompilers/default/setup.cshIf you would like these commands executed automatically each time you log in, you can add them to your
.loginfile.
A Sample FORTRAN Program calling an IMSL routine
Here's a very simple FORTRAN program calling the IMSL function TDATE, which returns today's date. This program will be called
test.fin the following examples. Remember, in FORTRAN each line of code must be indented:
indent--> INTEGER IDAY, IYEAR, MONTH EXTERNAL TDATE CALL TDATE(IDAY, MONTH, IYEAR) WRITE(*,*)'Day-Month-Year = ', IDAY, '-', MONTH, '-', IYEAR END
Compiling with IMSL
To compile the previous example, use the fortran compiler (f90) and link to the imsl library.
Host Command aludra
almaakTo compile with f90 and link to the imsl, socket, and nsl libraries:
f90 $F90FLAGS test.f $LINK_F90
Using IMSL FORTRAN routines in a C program
Whenever a C program calls FORTRAN routines, the C program must:
To compile, use a C compiler (
- convert the FORTRAN procedure name to lowercase
- append an underscore to the FORTRAN procedure name
- pass all arguments as pointers
gccfor example). There are several Fortran libraries that it may be necessary to link.
Starting with the new version of the fortran compiler, you must use a C compiler (
- If the FORTRAN routines call intrinsic or math functions, you must add the -lF90 and -lm options.
gcc) to create the object file for the C program, then use the fortran compiler (f90) to do the linking to the IMSL library and to create the executable.
A Sample C Program calling an IMSL Fortran routine
In this example, this C program calls the IMSL routine TDATE. This program will be called
test.cin the examples below.
main () { int day, year, month; tdate_(&day, &month, &year); printf("Day-Month-Year = %d-%d-%d\n", day, month, year); }To compile this program, use the following commands:
Host Command aludra
almaakTo compile the C code:
gcc -c test.c
To link the C object file with the imsl library:
f90 test.o -L /usr/usc/lib -limsl -lF90 -lM90 -lsocket -lnsl -lm
Documentation
For more information about using compilers, search the ITS Help System.
- IMSL C Numerical Libraries User's Guide
- IMSL Fortran Numerical Libraries -- MATH (including Special Functions)
- IMSL Fortran Numerical Libraries -- STAT
IMSL documentation is available in PDF format on the Visual Numerics Web Site:
Visual Numerics, Inc.
<support@houston.vni.com> === http://www.vni.com/
9990 Richmond Avenue, Suite 400
Houston TX 77042-4548
713/784-3131
www.vni.com/products/imsl/documentation/IMSL documentation is not normally available at the USC Bookstore. All hard-copy references must be obtained directly from Visual Numerics (
www.vni.com/). .