Re: Fast compressed_matrix from CSR/CSC triplets

"Ungermann, Jörn" <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <2116C2E56EA28B41BE9DA04D72921AFB0682E1@MBX2010-K01.ad.fz-juelich.de>
Hi,

in case memory is not such an issue, the fastest way would be in my
experience to first fill a coordinate_matrix of the correct majority and
then construct a compressed_matrix from the coordinate_matrix. Just use
append_element for the insertion into the coordinate_matrix, else the
constant sorting will kill the performance.

If memory is an issue, you need to sort your triplets first in an efficient
way. Using the coordinate_matrix does basically the sorting for you (it will
be sorted automatically once using std algorithms upon construct the
compressed_matrix).

Cheers,
Jörn

> -----Original Message-----
> From: [email protected] [mailto:ublas-
> [email protected]] On Behalf Of Rishi Amrit
> Sent: Donnerstag, 31. Mai 2012 15:12
> To: [email protected]
> Subject: Re: [ublas] Fast compressed_matrix from CSR/CSC triplets
> 
> Just to add to the woes, I may have the row/column indices vector (i.e.
> the one that corresponds to index2_data()) as unsorted.
> 
> On Thu, May 31, 2012 at 2:24 PM, Rishi Amrit <[email protected]>
> wrote:
> > Hi,
> >
> >  This might be trivial question, but I need to construct a
> > compressed_matrix from CSR / CSC triplets.
> > At the moment I'm using a nested for loop and using push_back, but
> > this is very slow. There has to be a faster way of constructing the
> > sparse matrix object from the CSR triplets. Any ideas ?
> >
> > R

_______________________________________________
ublas mailing list
[email protected]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [email protected]
smime.p7s (application/x-pkcs7-signature, 5.6 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.