Boost logo

Ublas :

Subject: [ublas] recommendation for submatrix assignment
From: Umut Tabak (u.tabak_at_[hidden])
Date: 2010-08-09 06:23:04

Dear all,

I was looking for some ways to assign submatrices efficiently in ublas(I
am using the precompiled binaries provided by Debian testing, not the
latest version of ublas), I have some questions on this and would be
glad if some experienced ones can help me:

+ which sparse matrix type is best suited for assignment(submatrix
assignment) and extraction?
+ is there a recommended strategy to follow?
+ I did a simple test with a mapped_matrix, assigning with(while reading
some matrix market formatted files), i am also reading the wiki of
Gunther Winkler which gives some important pointers and code samples,
thanks to him BTW.

mat->insert_element(I[i]-1, J[i]-1, val[i]);

seems to go fast however using subrange as in the below(assigning a
4158X4158 matrix with 37695 nnz entries)

40 subrange(C, 10000, 14158, 10000, 14158) = A;

seemed slow in comparison to the above assignment. These are the first
tries and I would like ask for advice to learn more and use more
efficient ways if there are any.

As a side note on timing using a 16236X16236 matrix with 149282
non-zeros, I got the output from with boost timer:

...matrix is loading into boost sparse matrix...
...matrix interfaced to boost in : 0.44
...matrix is being ported to PETSc sparseAIJ format...
...matrix ported to PETSc in : 0.38
starting subrange assignments
subrange assignments completed in : 39.84 (from subrange(C, 0, 16236, 0,
16236) = A;)

Any help and directions are appreciated.
Best regards,