| 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 |