New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1377 - Extracting Q matrix from SPQR produces compile error
Summary: Extracting Q matrix from SPQR produces compile error
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Sparse (show other bugs)
Version: 3.3 (current stable)
Hardware: All All
: Normal Unknown
Assignee: Nobody
Depends on:
Reported: 2017-01-18 20:16 UTC by Jeff Trull
Modified: 2017-02-20 13:35 UTC (History)
2 users (show)

matrixQ extraction with SparseQR (working) and SPQR (1.22 KB, text/x-c++src)
2017-01-18 20:16 UTC, Jeff Trull
no flags Details

Description Jeff Trull 2017-01-18 20:16:01 UTC
Created attachment 766 [details]
matrixQ extraction with SparseQR (working) and SPQR

The method I've used with SparseQR to extract the Q matrix - multiplying on the right by a dense identity matrix - does not work with SPQR, producing instead a compile error within Cholmod that looks like a trait extraction issue of some sort:

Eigen/src/CholmodSupport/CholmodSupport.h:143:47: error: third operand to the conditional operator is of type ‘void’, but the second operand is neither a throw-expression nor of type ‘void’
   res.d      = Derived::IsVectorAtCompileTime ? mat.derived().size() : mat.derived()
Eigen/src/CholmodSupport/CholmodSupport.h:144:14: error: ‘class Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, -1, -1> >’ has no member named ‘data’
   res.x      = (void*)(mat.derived().data());

A reduced test case is attached.
Comment 1 Gael Guennebaud 2017-02-20 13:35:36 UTC
You can workaround with:

 MatrixXd I = MatrixXd::Identity(mat.rows(), mat.cols());
 MatrixXd Q_ss = QR_ss.matrixQ() * I;

Note You need to log in before you can comment on or make changes to this bug.