MCPcopy Create free account
hub / github.com/Derious/cuMPC / analyzePattern

Method analyzePattern

dependence/eigen-3.4.0/Eigen/src/SparseQR/SparseQR.h:320–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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