Boost logo

Ublas :

Subject: Re: [ublas] recommendation for submatrix assignment
From: Ryo IGARASHI (rigarash_at_[hidden])
Date: 2010-08-09 07:13:56


2010/8/9 Umut Tabak <u.tabak_at_[hidden]>:
> 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?

The ALPS project ( uses
for submatrix assignment of Hamiltonian matrix for sparse
diagonalization application.
mapped_vector_of_mapped_vector is not documented, but apparently
available at least
since 1.33.

I verified only that assigning elements to
mapped_vector_of_mapped_vector was faster
than to compressed matrix. I don't know this is the fastest way or not.

For calculation such as matrix-vector multiplication, compressed matrix is the
fastest among those provided in matrix_sparse.hpp, Therefore for my program,
I decided to create matrix with mapped_vector_of_mapped_vector,
and then convert to compressed_matrix using the code like:

boost::numeric::ublas::mapped_vector_of_mapped_vector<double> Atmp;
...assigning elements...
boost::numeric::ublas::compressed_matrix<double> A(Atmp);

Best regards,