[eigen] adding constructor to SparseMatrix |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] adding constructor to SparseMatrix
- From: Daniel Lowengrub <lowdanie@xxxxxxxxx>
- Date: Mon, 7 Jun 2010 01:11:28 +0300
- Cc: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:cc:content-type; bh=H1hDbKqW2OAmxMADfGqD53P9kcHiuaGNKelCW9JjjWE=; b=HWuzQ/zgiBJTOeUZh6H2p4eG1CqxA9Rw0b0JE53n/2mLAaKQ1BXdFFNuoOKeFFM0gN 20ZvK6CIM7aBs5gc+oN251wi+i9nc6iDQZT3ECQG5J4SML7sRW/il8999CUpaX8qJZVW /8Z5b4xxYUwZcEQ+omE0k+0txBdQKRcWpMnPw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=SMOtdQcSSNI07/H88kcx41KbNEHqGwXAIPFuaLwa58Ex1c+oZWnCmb9/5KxosK5zV7 HyjjSCMED3TBo+u0m/Eiv2wygMAV4GGXMfPvajVBEJrpw1/RQ2MJG3h8Cw7ZtZ/+cO/U EoEAtY+6kbZDFcuSt61Zk+59094RPb0n0fqZA=
Sorry about the previous mis-post.
I think that it'd be useful to be able to quickly cast a regular
Matrix type into a SparseMatrix. I have two questions about the
implementation:
1) Would it be better to implement a new SparseMatrix ctor that
accepts a Matrix as an argument, or to implement a function like
sparseView in the Matrix class which returns a SparseMatrix?
2) At what level would it make sense for this to work? In the first
direction, a general MatrixBase shouldn't be able to be turned into a
SparseMatrix because this doesn't make sense for some subtypes of
MatrixBases such as expressions. In the other direction, if the
answer to the first question is to add a ctor, then should it be added
to SparseMatrixBase and be available to all of it's children, or
should it be specific to SparseMatrix? Casting a DenseMatrix to a
SparseMatrix is probably most useful when a DenseMatrix is constructed
as part of an algorithm but the algorithm requires operations like
factorization and linear system solving which are more efficient when
performed on a SparseMatrix [if the matrix is truly sparse]. Because
of this, casting a Matrix to a DynamicSparseMatrix doesn't seem too
helpful.
What do you think?
Daniel
On 6/7/10, Daniel Lowengrub <lowdanie@xxxxxxxxx> wrote:
>
>