Re: [eigen] add SparseView |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] add SparseView
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 14 Jun 2010 07:44:48 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=hJ/dvpMgjs51JVfJuG43PpHLB/UmK7MWutWwF0yPWtE=; b=oSbPpoNGagXBwmR9gfjP58rV7HCuBk23Qv8MNugJHqI2KAk4nrHMVUJkvbObElYX1d vUJ7Uwqu7pLbLlUNuTAV9KGUSuDMz5hTBQ4nsu3THFwzjqc+duSK+tve/cRmkyslpa32 dkNVCBEDWH32Ih5wNUTBvgdLAL90gZv2kJX2w=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=e8APsUevkBm1lAw95U5qUUD4kBRk6GE6NYEtKiHh4Hv+vQYIFk764Kxv+eH+JicYPJ CfXeU7/tdBGyr5PZ4CgLhx/69kGV0cTReymWP7bx7Jm6vwkveHleQv9o5FP6iDMimNCV o/d3FUf8N/lUBWetaJj7415KRMfil6btipiWM=
2010/6/14 Daniel Lowengrub <lowdanie@xxxxxxxxx>:
> Hi,
> I just added a SparseView class to the Sparse module.
> Usage:
> If d_mat is a DenseStorage matrix or expression then the sparseView
> method makes it compatible with Sparse types. For example:
> Matrix3d m3,m4;
> Eigen::SparseMatrix<double> smat(3,3);
>
> m3 << 1, 0, 0, 2, 0, 0, 7, 2, 0;
> m4 << 0, 6, 0, 0, 0, 5, 0, 0, 4;
> smat = (m3*m4 + m3).sparseView();
> std::cout << smat;
>
> outputs:
> Nonzero entries:
> (1,0) (2,1) (7,2) (6,0) (12,1) (44,2) (10,2)
>
> Column pointers:
> 0 3 6 $
>
> [and other sparse info]
>
> In addition, a reference variable and an epsilon variable may be
> passed which determine the threshold for which values will be ignored
> by the sparse matrix:
> smat = (m3*m4 + m3).sparseView(reference);
> and:
> smat = (m3*m4 + m3).sparseView(reference, epsilon);
I like this API!
Thanks Daniel!
Benoit
>
>
>