[eigen] Converting code SparseQR -> SuiteSparse SPQR |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Converting code SparseQR -> SuiteSparse SPQR
- From: Stéphane Mottelet <stephane.mottelet@xxxxxx>
- Date: Tue, 5 Mar 2024 10:00:05 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=utc.fr; s=mail; t=1709629206; bh=zxU2PpsHmD8eqrMfTHlLoYqMvawe7tR3+GAplEJPQOU=; h=Date:To:From:Subject:From; b=rupDPFHwzomIQC2Up3tSmnS6nAUuECzY2kX/QbR6XrTu51Xdn98cHnqBoW7RQ9Ses 66zHrBhY7ZaEPBpdQZr/aWaFAp05hVx1PXnZPTOIsQTlKWfFv/PqnzhN5flbgPIOey gcFAhfvWx9FsEA+HSTxzB71e8WAiboFSciTzHq9g=
Hello,
I have a code using regular SparseQR working fine (within a Scilab gateway):
typedef Eigen::SparseMatrix<double, 0x1, int> RealSparse_t;
types::Sparse *pSpA = in[0]->getAs<types::Sparse>();
types::Sparse::RealSparse_t* sp0 = pSpA->matrixReal;
Eigen::SparseQR <types::Sparse::RealSparse_t,
Eigen::COLAMDOrdering<int> > qr;
qr.compute(*sp0);
pOutR = new types::Sparse(new
types::Sparse::RealSparse_t(qr.matrixR()),NULL);
out.push_back(pOutR);
Eigen::SparseMatrix<double> Q;
Q = qr.matrixQ();
pOutQ = new types::Sparse(new types::Sparse::RealSparse_t(Q),NULL);
out.push_back(pOutQ);
I wanted to test SuiteSparse SPQR instead, but the mechanism to recover
the Householdr reflection list qr.matrixQ() as a regular matrix does not
seem to be supported, as the almost same as above following code
(Eigen::SparseQR is replaced by Eigen::SPQR and header include (not
shown here) is also updated)
typedef Eigen::SparseMatrix<double, 0x1, int> RealSparse_t;
types::Sparse *pSpA = in[0]->getAs<types::Sparse>();
types::Sparse::RealSparse_t* sp0 = pSpA->matrixReal;
Eigen::SPQR <types::Sparse::RealSparse_t> qr;
qr.compute(*sp0);
pOutR = new types::Sparse(new
types::Sparse::RealSparse_t(qr.matrixR()),NULL);
out.push_back(pOutR);
Eigen::SparseMatrix<double> Q;
Q = qr.matrixQ();
pOutQ = new types::Sparse(new types::Sparse::RealSparse_t(Q),NULL);
out.push_back(pOutQ);
does not compile and yields the following error (SPQR updated code
compiles and runs fine when extracting R only):
error: no viable overloaded '='
Q = qr.matrixQ();
How can I recover the Q matrix when using SuiteSparse SPQR ?
Thanks for your help.
--
Stéphane Mottelet
Ingénieur de recherche HDR
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet