|
Massively Parameterized Matrix Class
Submitted by |
It's almost been a month since the last matrix class submission. It's
time to do something about that.
This is a matrix class I have been working on lately. It has three major
fairly unusual features (actually it's more like two major and one
minor).
1. It minimizes the use of temporary objects by delaying the evaluation
of expressions until the final assignment by using closure objects.
matrix<3 A, B, C;
A = B * C; // no temporaries |
2. It generates code that evaluates expressions where you only have to
look at a single position in the involved matrices at a time
automatically. The generated code never uses a temporary.
vector<3 v, u, w;
float a, b;
v = (u * a + w * b) / (a + b); // vector interpolation, no temporaries |
3. operator* is used for both matrix multiplication, scalar product and
vector product.
A = B * C; // matrix multiplication
v = u * w; // vector product
a = u * w; // scalar product |
I hope somebody finds this useful, or at least interesting.
For more information see the index.html and README files.
|
The zip file viewer built into the Developer Toolbox made use
of the zlib library, as well as the zlibdll source additions.
|