You can download the original source and the paper from the G3 website. Updated sources are available from

MUTILS – MILAMIN utilities

MUTILS is a package that provides a set of utilities we find useful for high-resolution modeling. The tools are written in C and made available in MATLAB through the MEX interface, hence installation requires a working MEX compiler. The code is optimized for modern multi-core CPUs. Many functions are parallelized using OpenMP. Currently, the package includes the following functionality:

sparse_create – a routine that assembles sparse matrices resulting from the Finite Element Method. It is significantly faster than MATLAB’s sparse, and uses a lot less memory.
quadtree – a 2D quad-tree implementation with point-in-triangle location and spatial reordering functionality.
tsearch2 – a quad-tree based point-in-triangle location routine, similar to MATLAB’s tsearch, but significantly faster and parallelized with OpenMP.
einterp – a FEM interpolation routine using SSE2 instructions and OpenMP parallelization. Currently only the 7-node triangular element is supported, with more elements coming at users request.
SpMV – (in progress) fast sparse matrix-vector multiplication for SMP computers, parallelized using OpenMP. Support for symmetric matrices speeds up the execution by factor 2. Details described in Parallel symmetric sparse matrix-vector product on scalar multi-core CPUs by Krotkiewski and Dabrowski.

The package can be downloaded here.

External packages

To achieve best performance MILAMIN uses a number of external packages that need to be downloaded and compiled. Installation of these packages requires a working MEX compiler. Automatic download and installation scripts are distributed as part of the MUTILS package. For convenience, they are also provided separately here.

A 2D triangular mesh generator by Jonathan Shewchuk. The initial version of MILAMIN used a modified triangle executable with added binary input-output, which speeds up processing of large models considerably. A Windows executable can be downloaded here. For UNIX/Linux computers the sources need to be patched and compiled by the user. Detailed instructions are provided in the MILAMIN_1 package.

The new version of MILAMIN uses a MEX interface to triangle that bypasses disk IO altogether. It can be obtained with the MUTILS package.

SuiteSparse and Metis
MILAMIN uses some MEX files provided by Tim Davis in the SuiteSparse package: metis (a MATLAB interface to METIS graph partitioning library), cs_l(t)solve (forward/backward substitution), sparse2 (sparse matrix assembly routine that supports integer indices, faster than MATLAB’s sparse, but using a larger workspace). On older MATLAB versions lchol is used. To install these, download and unzip and run suitesparse_install in MATLAB.


You can download the original MILAMIN manuscript from the G3 website, where the optimized version of FEM implementation is documented. The paper also demonstrates a standard implementation of FEM to provide an educational insight into subjects such as implementation of the numerical method, efficient use of the computer architecture and computational libraries, code structuring, proper data layout, and solution techniques.