| 215 | |
| 216 | template<typename Rhs, typename Dest> |
| 217 | bool _solve_impl(const MatrixBase<Rhs> &B, MatrixBase<Dest> &X_base) const |
| 218 | { |
| 219 | Dest& X(X_base.derived()); |
| 220 | eigen_assert(m_factorizationIsOk && "The matrix should be factorized first"); |
| 221 | EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0, |
| 222 | THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); |
| 223 | |
| 224 | // Permute the right hand side to form X = Pr*B |
| 225 | // on return, X is overwritten by the computed solution |
| 226 | X.resize(B.rows(),B.cols()); |
| 227 | |
| 228 | // this ugly const_cast_derived() helps to detect aliasing when applying the permutations |
| 229 | for(Index j = 0; j < B.cols(); ++j) |
| 230 | X.col(j) = rowsPermutation() * B.const_cast_derived().col(j); |
| 231 | |
| 232 | //Forward substitution with L |
| 233 | this->matrixL().solveInPlace(X); |
| 234 | this->matrixU().solveInPlace(X); |
| 235 | |
| 236 | // Permute back the solution |
| 237 | for (Index j = 0; j < B.cols(); ++j) |
| 238 | X.col(j) = colsPermutation().inverse() * X.col(j); |
| 239 | |
| 240 | return true; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * \returns the absolute value of the determinant of the matrix of which |