How to install and use SDistribution v0.99 ------------------------------------------ Author: Sergej V. Aksenov (http://aksenov.freeshell.org/) Last revised: 23/9/02 -------- Contents -------- 1. Get and compile auxilliary software libraries 2. Compile MathLink executables 3. Install MathLink executables and SDistribution.m package in a appropriate place for easy Mathematica usage Now in more detail. ---------------------- 1. Auxilliary software ---------------------- ----------------------------------- a. Where to get auxilliary software ----------------------------------- You will need to download the following auxilliary software libraries: LERCHPHI, CVODE, F2C, CLAPACK, CBLAS, CFSQP. The URLs where to get the source code are given below. LERCHPHI: http://aksenov.freeshell.org/ or http://tqd1.physik.uni-freiburg.de/~ulj/ CVODE: http://www.netlib.org/ode/ F2C: http://www.netlib.org/f2c/ CLAPACK and CBLAS: http://www.netlib.org/clapack/ CFSQP: http://gachinese.com/aemdesign/FSQPframe.htm Important note about CFSQP availability. AEM Design, Inc. license prohibits redistribution of CFSQP source code to third parties. It can be obtained free of charge (for academic users) directly from AEM Design, Inc. You will also need two more libraries, ZEROIN and DFO. These were originally written in Fortran so I have have translated them to C with F2C and also modified the translated C code in order to interface with the rest of the SDistribution C programs. These modifications are described in the file MODIFICATION. The modified codes are distributed together with the SDistribution source code and can be found in subdirectories SDistribution/ZEROIN and SDistribution/DFO. Thus normally you won't need the original Fortran source codes, but just in case, they can be found at the following URLS. ZEROIN: http://www.netlib.org/fmm/ DFO: http://oss.software.ibm.com/developerworks/opensource/coin/ ------------------------------------- b. How to compile auxilliary software ------------------------------------- Before compiling the SDistribution MathLink binaries (for which see section 2), you will need to compile F2C, CLAPACK, DFO, and CVODE libraries and deposit library files and relevant header files into their placeholder subdirectories within the SDistribution/ tree. Also, you will need to place LERCHPHI, CFSQP, and ZEROIN source codes in their respective placeholders. In the end you should get the following tree. SDistribution/LIBF2C/libF77.a SDistribution/LIBF2C/libI77.a SDistribution/LIBF2C/f2c.h SDistribution/CLAPACK/libblas.a SDistribution/CLAPACK/liblapack.a SDistribution/CLAPACK/clapack.h SDistribution/CLAPACK/blaswrap.h SDistribution/DFO/libdfo.a SDistribution/CVODE/libcvode.a SDistribution/CVODE/band.h SDistribution/CVODE/cvdiag.h SDistribution/CVODE/iterativ.h SDistribution/CVODE/spgmr.h SDistribution/CVODE/cvband.h SDistribution/CVODE/cvode.h SDistribution/CVODE/llnlmath.h SDistribution/CVODE/cvbandpre.h SDistribution/CVODE/cvspgmr.h SDistribution/CVODE/llnltyps.h SDistribution/CVODE/cvdense.h SDistribution/CVODE/dense.h SDistribution/CVODE/nvector.h SDistribution/LERCHPHI/lerchphi.c SDistribution/CFSQP/cfsqp.c SDistribution/CFSQP/qld.c SDistribution/CFSQP/cfsqpusr.h SDistribution/ZEROIN/zeroin.c Below are some instructions on how to compile these libraries successfully, which I personally tested on a MacOS X and Sun Solaris machines. You might have some problems depending on your computer system. Consult documentation of the above libraries for more information about the compilation. --- F2C --- Download source code bundles libf77 and libi77, sh them to unbundle, put them into separate directories, then edit their makefiles in the following way. For libf77, set compiler to gcc on line 2. Also, if your system, such as Solaris, does not understand ld -x, delete ld option -x on line 18. For libi77, leave Sun CC as your compiler if your system is Sun Solaris. Also, if your system, such as Solaris, does not understand ld -x, delete ld option -x on line 18. Download f2c.h and place it in both directories. Execute make in each of the directories and copy the resulting library files libF77.a and libI77.a as well as f2c.h into its placeholder SDistribution/LIBF2C ----------------- CLAPACK and CBLAS ----------------- Download the source code bundle clapack.tgz and unbundle it with tar -zxf. Then edit make.inc in the follwoing way: set compiler to gcc on line 19 and linker to gcc on line 21; adjust compiler options CFLAGS, LOADOPTS, NOOPT options according to your system. Finally, set F2CLIB to whereever you store libF77.a and libI77.a from the previous step on line 46 (note that this path can be given as relative to BLAS/SRC location). Now go to BLAS/SRC subdirectory and type "make double" to compile BLAS library in double precision (because SDistribution source is in double). Then go to SRC/ subdirectory and type "make double" to compile LAPACK library in double precision. The librarties will be located in the root CLAPACK/ Now rename them to libblas.a and liblapack.a and copy to their placeholder SDistribution/CLAPACK Also copy header files CLAPACK/clapack.h and CLAPACK/BLAS/WRAP/blaswrap.h to the same location. --- DFO --- Just execute make in SDistribution/DFO, there should be no problem compiling. Note that F2C and CLAPACK and CBLAS headers should already be in their places within the SDistribution/ tree since they are needed for DFO compilation. ----- CVODE ----- Download tarball cvode.tar.gz, gunzip and unar it. Then cd to CVODE/ and type make. Library libcvode.a will be created in CVODE/lib subdirectory. Copy it to its placeholder in SDistribution/CVODE Also copy all headers from CVODE/include to SDistribution/CVODE ---------------------------- 2. Compile MathLink binaries ---------------------------- This distribution contains a Makefile for UNIX systems in the root SDistribution/ directory. First you will need to tune this Makefile for the particular system. In the preamble of the Makefile, please indicate name and location of the C compiler, MathLink preprocessor mprep, MathLink library and header, and paths to auxilliary libraries and headers. Note that it will help if path to C compiler, mprep are in systems's path already. Please consult your MathLink documentation for the system-specific location of MathLink files. The path to MathLink will likely resemble this one on a Mac OS X machine: /Applications/Mathematica 4.1.app/AddOns/MathLink/DevelopersKits/Darwin/CompilerAdditions/ or this one on a Sun Solaris machine: /usr/local/packages/mathematica-4.1/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/ Paths to auxilliary libraries and headers are by default set to locations within the distribution tree SDistribution/. Unless you prefer to keep auxilliary libraries in different (e.g., system-wide) locations, you don't need to change anything here. Finally, simply type "make" at the command prompt to build all three executables. These executables will be created in the same directory as Makefile and SDistribution.m. Typing "make lerch" will create lerch; the same for cdf.exe and optim.exe. Type "make clean" to remove all object files, binaries will remain. Building on other platforms and with various integrated programming environments can be done by examining the Makefile for dependencies and library linking. ------------------ 3. Install package ------------------ One convenient way to install the package is to copy the package file SDistribution.m and MathLink executables lerch.exe, cdf.exe, and optim.exe into the directory SDistribution/ that you have created in either Mathematica installation path or Mathematica preference path; in this way there will be no hassle with the $Path variable and the loading procedure is identical on all systems: <. Also note that you might get by without the binaries by using standard Mathematica functions, although functionality of the package (and speed) might be impaired. See SDistribution.nb for details. [End of README file]