MCPcopy Create free account
hub / github.com/PX4/eigen / analyzePattern

Method analyzePattern

Eigen/src/SparseQR/SparseQR.h:307–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305 */
306template <typename MatrixType, typename OrderingType>
307void SparseQR<MatrixType,OrderingType>::analyzePattern(const MatrixType& mat)
308{
309 eigen_assert(mat.isCompressed() && "SparseQR requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to SparseQR");
310 // Copy to a column major matrix if the input is rowmajor
311 typename internal::conditional<MatrixType::IsRowMajor,QRMatrixType,const MatrixType&>::type matCpy(mat);
312 // Compute the column fill reducing ordering
313 OrderingType ord;
314 ord(matCpy, m_perm_c);
315 Index n = mat.cols();
316 Index m = mat.rows();
317 Index diagSize = (std::min)(m,n);
318
319 if (!m_perm_c.size())
320 {
321 m_perm_c.resize(n);
322 m_perm_c.indices().setLinSpaced(n, 0,StorageIndex(n-1));
323 }
324
325 // Compute the column elimination tree of the permuted matrix
326 m_outputPerm_c = m_perm_c.inverse();
327 internal::coletree(matCpy, m_etree, m_firstRowElt, m_outputPerm_c.indices().data());
328 m_isEtreeOk = true;
329
330 m_R.resize(m, n);
331 m_Q.resize(m, diagSize);
332
333 // Allocate space for nonzero elements : rough estimation
334 m_R.reserve(2*mat.nonZeros()); //FIXME Get a more accurate estimation through symbolic factorization with the etree
335 m_Q.reserve(2*mat.nonZeros());
336 m_hcoeffs.resize(diagSize);
337 m_analysisIsok = true;
338}
339
340/** \brief Performs the numerical QR factorization of the input matrix
341 *

Callers

nothing calls this directly

Calls 10

coletreeFunction · 0.85
isCompressedMethod · 0.45
colsMethod · 0.45
rowsMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
inverseMethod · 0.45
dataMethod · 0.45
reserveMethod · 0.45
nonZerosMethod · 0.45

Tested by

no test coverage detected