| 190 | /** \internal */ |
| 191 | template<typename Rhs, typename Dest> |
| 192 | bool _solve_impl(const MatrixBase<Rhs> &B, MatrixBase<Dest> &dest) const |
| 193 | { |
| 194 | eigen_assert(m_isInitialized && "The factorization should be called first, use compute()"); |
| 195 | eigen_assert(this->rows() == B.rows() && "SparseQR::solve() : invalid number of rows in the right hand side matrix"); |
| 196 | |
| 197 | Index rank = this->rank(); |
| 198 | |
| 199 | // Compute Q^T * b; |
| 200 | typename Dest::PlainObject y, b; |
| 201 | y = this->matrixQ().transpose() * B; |
| 202 | b = y; |
| 203 | |
| 204 | // Solve with the triangular matrix R |
| 205 | y.resize((std::max<Index>)(cols(),y.rows()),y.cols()); |
| 206 | y.topRows(rank) = this->matrixR().topLeftCorner(rank, rank).template triangularView<Upper>().solve(b.topRows(rank)); |
| 207 | y.bottomRows(y.rows()-rank).setZero(); |
| 208 | |
| 209 | // Apply the column permutation |
| 210 | if (m_perm_c.size()) dest = colsPermutation() * y.topRows(cols()); |
| 211 | else dest = y.topRows(cols()); |
| 212 | |
| 213 | m_info = Success; |
| 214 | return true; |
| 215 | } |
| 216 | |
| 217 | /** Sets the threshold that is used to determine linearly dependent columns during the factorization. |
| 218 | * |