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