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

Method _solve_impl

dependence/eigen-3.4.0/Eigen/src/SparseLU/SparseLU.h:314–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312
313 template<typename Rhs, typename Dest>
314 bool _solve_impl(const MatrixBase<Rhs> &B, MatrixBase<Dest> &X_base) const
315 {
316 Dest& X(X_base.derived());
317 eigen_assert(m_factorizationIsOk && "The matrix should be factorized first");
318 EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,
319 THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
320
321 // Permute the right hand side to form X = Pr*B
322 // on return, X is overwritten by the computed solution
323 X.resize(B.rows(),B.cols());
324
325 // this ugly const_cast_derived() helps to detect aliasing when applying the permutations
326 for(Index j = 0; j < B.cols(); ++j)
327 X.col(j) = rowsPermutation() * B.const_cast_derived().col(j);
328
329 //Forward substitution with L
330 this->matrixL().solveInPlace(X);
331 this->matrixU().solveInPlace(X);
332
333 // Permute back the solution
334 for (Index j = 0; j < B.cols(); ++j)
335 X.col(j) = colsPermutation().inverse() * X.col(j);
336
337 return true;
338 }
339
340 /**
341 * \returns the absolute value of the determinant of the matrix of which

Callers

nothing calls this directly

Calls 9

matrixLMethod · 0.95
matrixUMethod · 0.95
XFunction · 0.85
resizeMethod · 0.45
rowsMethod · 0.45
colsMethod · 0.45
colMethod · 0.45
solveInPlaceMethod · 0.45
inverseMethod · 0.45

Tested by

no test coverage detected