| 336 | |
| 337 | template <typename Rhs, typename Dest> |
| 338 | bool _solve_impl(const MatrixBase<Rhs>& B, MatrixBase<Dest>& X_base) const { |
| 339 | Dest& X(X_base.derived()); |
| 340 | eigen_assert(m_factorizationIsOk && "The matrix should be factorized first"); |
| 341 | EIGEN_STATIC_ASSERT((Dest::Flags & RowMajorBit) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); |
| 342 | |
| 343 | // Permute the right hand side to form X = Pr*B |
| 344 | // on return, X is overwritten by the computed solution |
| 345 | X.resize(B.rows(), B.cols()); |
| 346 | |
| 347 | // this ugly const_cast_derived() helps to detect aliasing when applying the permutations |
| 348 | for (Index j = 0; j < B.cols(); ++j) X.col(j) = rowsPermutation() * B.const_cast_derived().col(j); |
| 349 | |
| 350 | // Forward substitution with L |
| 351 | this->matrixL().solveInPlace(X); |
| 352 | this->matrixU().solveInPlace(X); |
| 353 | |
| 354 | // Permute back the solution |
| 355 | for (Index j = 0; j < B.cols(); ++j) X.col(j) = colsPermutation().inverse() * X.col(j); |
| 356 | |
| 357 | return true; |
| 358 | } |
| 359 | |
| 360 | /** \brief Give the absolute value of the determinant. |
| 361 | * |