Xmath - The eXtended Math Library


When writing scientific programs the computational scientist often has to solve reoccurring numerical problems. Now there exists of course a wealth of numerical libraries for exactly this reason. Most of these libraries are written in FORTRAN and issues such as index order and dynamic memory allocation render their use in C programs very inflexible and hindering. The existing C adaptations of these established libraries are merely more than a change in syntax and do not change the inherent shortcomings.

Consequently we started collecting the numerical functions that were needed in our scientific projects in a distinguished library, the eXtended Math Library. At the moment the Xmath library is comprised of eight modules, each covering a certain area of numerical problems. The Xmath library is not meant to be a complete numerical library by any means but rather serves as a small, self contained set of functions that were needed for our own projects.

Download & Install

Download the latest Xmath package: Xmath-Gans-2.tgz
Then type
tar xzvf Xmath-Gans.tgz to unpack or, alternatively, gunzip and untar the file in two separate steps. This creates a directory named Xmath which contains all the necessary files. Change into this directory and customize the makefile. Then type make. This should leave you with the library file named libxmath.a.

Note: For convenience the Xmath package includes pre-compiled static library files in the FFTw subdirectory that contain the functions of the FFTw library. The provided library files cover a variety of platforms and compilers:

Libraries for additional platforms or compilers can be generated by installing the FFTw package.

Xmath Modules


Simplifies the handling of dynamic arrays of various types and dimensions. Includes functions to allocate continuous memory, multi-index arrays.


Complex data types and associated functions... Until we all have C99 compilers...


Access to the well established FFTw library. The main reason for this wrapper module was our wish to allow easy access to other FFT libraries without causing major changes in the programs that use the Xmath library. For this reason many of the flexible FFTw calls are wrapped in very specific xmfft calls. At this point xmfft supports FFTw 2.1.2. To use the xmfft functions the FFTw library needs to be installed on the system. Xmath's subdirectory FFTw is the default location and should contain the two header files fftw.h and rfftw.h next to the actual library files which need to be linked to the code that uses calls from the xmfft module.


Simple Simpson form for numerical integration.


3rd order Simpson's rule interpolation.


Isosurface routines for three dimensional data arrays.


Basic linear algebra routines.


Short miscellaneous calls.

To Do List


'Xmath' - The eXtended Math Library
Copyright (C) 2000 University of California, Santa Barbara

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA