Searching for a Fortran style Matrix Class in C#

As a quant developer I often work with mathematicians who know and love Fortran.  Personally I hate working with this language except for its beautiful handling of matrices.  I’m currently working on building a Value at Risk system in the electricity industry, and I’ve decided to do the lot in C#, with perhaps some shelling out to Matlab, but I don’t want to unwind my vectors and matrices in order to operate on their elements, rather I want to do operations on the matrices as we do in Fortran.

The following link seems to have what I’m looking for, and to boot, consideration has been given to doing it efficiently:

The documentation is a bit thin, so I’m just jumping in.  It seems to have this smart way of constructing a tree of operations, then waiting until told to evaluate these all at once.  This has led to some confusion on my part.

Vector q = new Vector(3)
Vector r = new Vector(3)

..after assigning values to q, I wanted r to hold log(q), and tried this:


since the following doesn’t work due to the way the expression evaluator works:

r = Expr.Log(q);

After some mucking around I found that I need to do the following:


A bit clunky perhaps, but much better than any other method I know.

Comments are closed.