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

Sparse modules and maturity level

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

Sparse modules and maturity level

Sun Apr 10, 2011 8:44 pm
Dear developers,

Being a 5-minute user of eigen3 ;-), I have some several naive questions.

As a first check, I took a look at the benchmark pages and saw that eigen beats even the Intel MKL most of the time, so it might be a good idea to use eigen maybe instead of ublas.

However, I was wondering the maturity level of eigen sparse matrix modules and the related sparse solvers. And eigensolvers if any. And one more point, you also need some complete examples for the sparse matrix section, humble opinion: not code sections but complete codes to see what is more or less needed to compile the source successfully.

Edit:
I am assembling some finite element matrices from a commercial code, so what could be the fastest matrix to insert the values into a sparse format? Then on I will try to code some cg type methods and try to see the performance of the library on large problems. Sorry for so many edits and changes at once ;)

For instance matrix-vector products are far more the most important for me and most of the people in the numerical field.

However, when defining a very simple fill out test ends with an error that the sparse module is not stable. As such:

#include <iostream>
#include <Eigen/Sparse>

#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET // if with this

using Eigen::SparseMatrix;
using Eigen::SparseMatrix::RowMajor; // I guess
int main()
{
SparseMatrix< double, RowMajor > mat(1000,1000);
for(int i=0; i<1000; ++i)
{
for(int j=0; j<1000; ++j)
mat.insert(i,j) = value;
}
return 0;
}

Greetings,
Umut

Last edited by utab on Sun Apr 10, 2011 9:29 pm, edited 1 time in total.
utab
Registered Member
Posts
2
Karma
0
OS
#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET // if with this

Sorry my ignorance, forget to give this on the command line to g++. Problem solved however questions still await answers ;)
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Sparse modules and maturity level

Wed Apr 13, 2011 11:34 am
Hi,

utab wrote:Dear developers,
However, I was wondering the maturity level of eigen sparse matrix modules and the related sparse solvers. And eigensolvers if any. And one more point, you also need some complete examples for the sparse matrix section, humble opinion: not code sections but complete codes to see what is more or less needed to compile the source successfully.


it is ok to use the sparse module for basic usage. Typically, you can efficiently assemble your matrix using either the coherent .insert() API or a temporary DynamicSparseMatrix. In the future, I plan to offer more assembly possibilities and flexibilities. Regarding the direct solvers, there is currently only one built-in solver which is mature enough: SimplicialCholesky. It is typically half as fast as Cholmod, that is not bad at all. In the future this solver will be extended to general square matrices (LU factorization), and optimized via supernodes and out-of-core ability. For LU solving you can use the SparseLU common interface to UmfPack and SuperLU libraries.

There is also a built-in SparseLLT solver which can be used as a fast preconditioner if using a large threshold value.


The eigensolvers for dense matrices are quite mature, however we don't provide any eigensolver for sparse matrices.



Edit:
I am assembling some finite element matrices from a commercial code, so what could be the fastest matrix to insert the values into a sparse format? Then on I will try to code some cg type methods and try to see the performance of the library on large problems. Sorry for so many edits and changes at once ;)


if you can insert your nonzeros in a coherent order, then use SparseMatrix::insert(i,j) function.

I'll try to add a simple demo of Laplace solver using FEM as soon as possible.


For instance matrix-vector products are far more the most important for me and most of the people in the numerical field.



Regarding sparse-matrix time dense vector product, it is as fast as other general libraries. In the special case where the sparse structure of the matrix does not change over many products, then there exist much faster algorithms which are not implemented yet into Eigen (nor ublas).


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora