Nicolas Brodu

C H E A P M A T R I X
Nicolas
Brodu
C H E A P M A T R I X

# Description

CheapMatrix is a library for computing with matrices in C++. It can link with LAPACK and benefit from the great features of this excellent linear algebra library written in FORTRAN.

I coded CheapMatrix during my MSc by Research in the UK (Aston University). As my supervisor wasn't familiar with C++, I wrote this library with simplicity of use in mind. In particular, regular users of Matlab should be able to read, understand, and why not write, the code in C++ making use of CheapMatrix.

The goal is to provide ready-to-use matrices, without having to instantiate lots of templates, nor fancy syntaxes.

For example, you can write directly:

```    Matrix a(4,4);
Vector v(4);
a =  1,  2,  3,  4,
5,  6,  7,  8,
9, 10, 11, 12,
13, 14, 15, 16;

v = 0.1, -0.2, 0.3, -0.4;

Vector b = a * v;

etc...```

or, equally easy:

```    Vector a = range(1,100);
Matrix b = a * sin(a).transpose();```

CheapMatrix is written for scientists, who do not necessarily want to spend time to understand all the subtleties of C++, but rather to do computations.

In this respect, CheapMatrix can link with LAPACK and thus provide functions among the most advanced in linear algebra. The goal is to provide a simple syntax in C++, rather than having to code in FORTRAN or plain C to use LAPACK.

Last but not least, CheapMatrix was conceived to optimize memory usage over speed. This doesn't mean computations are slow; quite the contrary, since LAPACK is used for complex computations, the performances are actually quite good. It's just that CheapMatrix is not a matrix engine dedicated to 100 frames per second 3D games.

# Extensions

CheapMatrix has several extensions:

- Basic tools: predefined matrices, statistic functions (mean, standard deviation, etc.), range definition, matrix generated by functions, etc...

- Optimization routines: Scaled conjugate gradients and simulated annealing are implemented. An example is provided, using those methods on a sine, and on a neural network.

- LAPACK. Ready to use functions are written for singular value decomposition, least square estimation, matrix inversion, eigen value computation. Those interfaces to LAPACK serve as an example how to call any other LAPACK function.

CheapMatrix is a project based on SourceForge. You'll find more information on the project site.

# Projects

Two projects make used CheapMatrix:

- My own MSc by Research project.

- A project of the French "Caisse Primaire d'Assurance Maladie", for statistic computations.

Style:
S O F T W A R E
C
H
E
A
P
M
A
T
R
I
X
C
H
E
A
P
M
A
T
R
I
X