Free sources for numerical methods and math-intensive code

July 14, 2008 · Filed Under Software development 
From: Shawn Gay

As a scientific programmer, I am always on the lookout for open-source or free numerical method and math software libraries to leverage in my programs. There are some very useful packages out there that can make life a lot sweeter when you are writing physics, engineering, or other computationally complex code.

Boost Libraries

The Boost libraries are a great resource for C++ developers and are distributed under a very liberal open-source license, friendly to both non-commercial and commercial projects. While the scope of the Boost libraries goes far beyond numerical methods, there are some very useful elements that are very helpful in this context. Here are a few of my favorites:

  • Boost Function:  This set of classes provides generic function object wrappers. If you’ve ever needed to pass around a generic function, not knowing if the original function is a stand-alone function, a static member function, or a member function of a class instance, this is the solution for you. I use Boost Function objects anytime I am working with functional operations such as numerical integration, optimization, etc. This way, I can pass functions as arguments to my interfaces and store the functions as member variables for later use.
  • Boost Multiarray: This package provides generic template classes for storing and operating on multidimensional arrays. In C++, it can quickly become tedious to construct vectors of vectors of vectors to deal with arrays that have multiple indexes. The Boost Multiarray class provides a very concise and elegant syntax for handling this situation.
  • Boost uBLAS: The uBLAS package provides linear algebra operations for C++ at the BLAS levels 1, 2 and 3. Use this library, and you’ve got a generic way to do most standard linear algebra operations for one- and two-dimensional arrays.
  • Boost Random: This library provides extensive pseudo-random number generators for statistical calculations, Monte Carlo simulations, etc. The thing I really like about the Boost Random library is how easy it makes it to swap different random number algorithms. I also like the clean interface.

Blitz Libraries

The Blitz libraries provide high-performance scientific computing functionality to C++ on a level with the performance of FORTRAN 77 or FORTRAN 90. The Blitz library is distributed under either GPL or the Blitz artistic license, similar to the PERL license. The user gets to choose the license terms. The library provides classes to handle multi-dimensional arrays, a tiny vector class to handle arrays of size known at compile time, random number generators, and a variety of IEEE/System V math functions.

Muparser library

The Muparser library provides a way to parse and evaluate mathematical expressions typed in by a user. This is a very handy resource for interactive math applications.

 

Comments

Leave a Reply