Re: [eigen] Sparse Matrix Support |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Sparse Matrix Support*From*: Sameer Agarwal <sameeragarwal@xxxxxxxxxx>*Date*: Fri, 18 Jun 2010 10:56:44 -0700*Dkim-signature*: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1276883810; bh=WD84/l4kWltmKFmyaR4BzH1QcdU=; h=MIME-Version:In-Reply-To:References:Date:Message-ID:Subject:From: To:Content-Type; b=lNIQwOhcVLtG0qyDRvnk+ttGxmF8goe4WZ8tnoiUTd1a0dSvMQtRk9XGSAXc33b11 Ho5OMf4aVaOdTXCNjh+8Q==*Domainkey-signature*: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:in-reply-to:references:date:message-id:subject:from:to: content-type:x-system-of-record; b=IC+RiITdLVo/27kBHL7xSFZ1+tnPDas1mltiisoZLyXbfbUI32b166++nc5uBv4/j 0u5cdw2CdHuml6ygtFiAQ==

Ok, since that's a standard approach it's probably good to support

though I doubt it's the most efficient way of doing this. I plane to

simply provide a template Tripplet<Scalar,Index> class and then let

the user takes its favorite container like std::vector<Tripplet>.

I would argue for a lower level interface with three arrays/iterators instead of one, as this would allow for easy interface with cholmod_triplet and matlab.

> And last but not the least, have you given any thought to supporting

> block sparse matrices?This is very tricky and I'm still not sure how to implement it the

most efficient and simple way. Indeed, the idea is of course to reuse

the SparseMatrix class and let it stores small fixed size dense Matrix

for the scalar type. For instance, let's assume a 300x300 block matrix

represented as a 100x100 standard sparse matrix of Matrix3d. The pb is

that depending on the context, sometimes we want to see it as a

300x300 matrix of double, and sometimes as a 100x100 matrix of

Matrix3d blocks. So this probably requires a lot of work to get it

right.

Block sparse matrices have two uses. One as Trevor pointed out and I had forgotten, ease of representation for problems coming from PDEs. So we should see if we can allow for building sparse matrices out of a list of triplets just like we do for scalars.

The other is high performance operations. One way would indeed be to store the matrix as a collection of dense blocks and then represent matrix vector products as operations on these blocks using dense BLAS operations.

But this does not necessarily require uniform block sizes. For example in the problem of interest to me, I am interested in storing block sparse jacobians where different blocks are of different size and the matrix itself is extremely rectangular.

In those cases, we could just store i,j, row_size, col_size, double* or a block CSR or CSC version of it and that leads to a 2-3 times speedup over storing it has a generic sparse matrix.

Designing a good API for this will require some effort, but I think its worth it.

Sameer

**Follow-Ups**:**Re: [eigen] Sparse Matrix Support***From:*Gael Guennebaud

**References**:**[eigen] Sparse Matrix Support***From:*Sameer Agarwal

**Re: [eigen] Sparse Matrix Support***From:*Gael Guennebaud

**Re: [eigen] Sparse Matrix Support***From:*Sameer Agarwal

**Re: [eigen] Sparse Matrix Support***From:*Gael Guennebaud

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Sparse Matrix Support** - Next by Date:
**Re: [eigen] Sparse Matrices in Eigen** - Previous by thread:
**Re: [eigen] Sparse Matrix Support** - Next by thread:
**Re: [eigen] Sparse Matrix Support**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |