This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen sparse matrix code generation

Tags: None
(comma "," separated)
joelandersson
Registered Member
Posts
2
Karma
0
OS

Eigen sparse matrix code generation

Tue Sep 13, 2011 2:20 pm
Hello!

I have a symbolic framework where I am able to construct and manipulate mathematical expressions consisting of sparse matrix-valued operations. For these expressions I calculate the sparsity "on-the-fly" and use reference counted sparsity to allow multiple expressions to share the same sparsity pattern.

To evaluate these expressions I have written a small virtual machine.

This means pretty much that what I do in the runtime is what Eigen does at compile time (using expression templates) and what Eigen does at runtime, I do in my virtual machine.

Now, I would like squeeze the maximum performance out of my code by generating Eigen code out of the expressions. My expression will thus translate to a sequence of sparse matrix-valued operations. The nice thing is that I already know not only the dimensions, but also the number of nonzeros and even the location of all nonzeros of these matrices so I could generate Eigen-C++ code with all sparsity fixed at compile-time.

So, is there some way already, or do you plan to add some way in order to pass the matrix sparsity pattern to a sparse matrix as template parameters and then exploit this in the algorithm?

Best,
Joel
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
There is no plan for such things. Use cases seems to be very seldom.

I'm not sure to fully understand your final goal, but let me suggest an alternative approach (maybe). Since Eigen can handle custom scalar type, the idea would be to create a new scalar type that would output C code to the standard output and thus generating fully unrolled code. That's just a naive idea, I'm not sure that's so straightforward, probably not !


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]