This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 236

Summary: qr_colpivoting_3 fails sometimes for rank 1 matrices.
Product: Eigen Reporter: Gael Guennebaud <gael.guennebaud>
Component: QRAssignee: Nobody <eigen.nobody>
Status: NEW ---    
Severity: Unknown    
Priority: ---    
Version: 3.0   
Hardware: All   
OS: All   
Whiteboard:

Description Gael Guennebaud 2011-03-25 15:05:27 UTC
Seed to reproduce: s1301044630

The problem happens when testing the rank of a rank 1 matrix. In ColPivHouseholderQR::rank(), line 202, there is like a factor 2 or 3 between premultiplied_threshold and the and the second biggest pivot which are both 1e-16 times smaller than the biggest. So nothing serious.

Nevertheless, if in the creation of a rank-one matrix (test/main.h, line 423), I remove the normalized(), then the "probably wrong negatives" go away.
Comment 1 Gael Guennebaud 2011-03-25 16:01:45 UTC
For the record, reflapack or mkl does no fails on this particular seed, but they fails on other matrices, e.g. with a rank 2 while Eigen passes. So I'd say even.


Here is the piece of code to call LAPACK from ColPivHouseholderQR (for complexes):

  int M = rows;
  int N = cols;
  int LDA = rows;
  int INFO = 0;
  VectorXd rwork(2*cols);
  VectorXi jpvt(cols);
  jpvt.setZero();
  m_qr = matrix;
  zgeqpf_( &M, &N, &m_qr.real().coeffRef(0,0), &LDA, jpvt.data(), &m_hCoeffs.real().coeffRef(0), &m_temp.real().coeffRef(0), rwork.data(), &INFO);
  
  m_maxpivot = internal::real(m_qr(0,0));
  m_nonzero_pivots = 0;
  for(Index k = 0; k < size; ++k)
    if(m_qr(k,k)!=Scalar(0))
      m_nonzero_pivots++;
  
  m_colsTranspositions = jpvt.cast<typename IntRowVectorType::Index>().array() - 1;
  m_colsPermutation.setIdentity(cols);
  for(Index k = 0; k < m_nonzero_pivots; ++k)
    m_colsPermutation.applyTranspositionOnTheRight(k, m_colsTranspositions.coeff(k));
  
  m_isInitialized = true;
  
  return *this;
Comment 2 Nobody 2019-12-04 10:35:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/236.