MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / analyzePattern

Method analyzePattern

include/Eigen/Eigen/src/SparseQR/SparseQR.h:322–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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