fix QR solving with m>n

This commit is contained in:
Gael Guennebaud 2010-07-15 19:52:11 +02:00
parent c7b8de77c0
commit b09bb50aeb

View File

@ -270,14 +270,14 @@ bool QR<MatrixType>::solve(
ei_assert(m_isInitialized && "QR is not initialized.");
const int rows = m_qr.rows();
ei_assert(b.rows() == rows);
result->resize(rows, b.cols());
result->resize(m_qr.cols(), b.cols());
// TODO(keir): There is almost certainly a faster way to multiply by
// Q^T without explicitly forming matrixQ(). Investigate.
*result = matrixQ().transpose()*b;
if(m_rank==0)
return result.isZero();
return result->isZero();
if(!isSurjective())
{