MatForce: Supporting rapid algorithm development by automatic translation of MatLab prototypes into C++

MatForce is a compiler that automatically translates MatLab scripts into self-contained C++ code, producing human-readable, extensible C++ sources that can subsequently be fitted to the needs of the encapsulating application.

MatLab is an essential tool in high-productivity development of applications that involve much scientific computation. Problems can be presented in a familiar mathematical formalism and the simple yet extensive visualization capabilities support rapid algorithm and model prototyping. Nonetheless, for the sake of efficiency and homogeneity, it is often necessary to convert MatLab code into C or C++, which is a tedious and error-prone task if performed manually. MatForce helps leverage the advantages of both prototyping in MatLab for rapid development and finalizing code in C++ for the sake of efficiency and integration.


The MatLab to C++ compilation and link process

The MatForce system comprises of three easily identifiable parts. The compiler performs the MatLab to C++ translation with type inference, yielding C++ code. The utility library contains the implementation of matrix operations. The C++ compiler translates both the utility library and the C++ source code produced by the MatForce compiler into object files. The linker binds the object files to the high-performance linear algebra library, which carries out computation-intensive operations. The resultant executable has the structure shown below.

The structure of a MatForce executable

Standards conformance

The MatForce compiler is written in SWI-Prolog but is generally portable, relying mostly on Definite Clause Grammar (DCG) rules for tokenization, parsing and code generation. Every effort is made to make the utility library comform to the ANSI C++ standard. The utility library has been successfully compiled with Microsoft Visual Studio 98, 2003 and 2005 (with version-dependent auxiliary code). The linear algebra library has been created by combining the ATLAS and LAPACK libraries, using the former for Basic Linear Algebra Subprogram (BLAS) routines and whenever it had a machine-tuned efficient LAPACK routine implementation. Both libraries are written in Fortran77 and have been compiled with g77.

Repository details

Repository path /cvsroot/prospear
User anonymous
Connection type pserver


See also Logo