| 205 | /** \internal */ |
| 206 | template<typename Rhs, typename Dest> |
| 207 | bool _solve_impl(const MatrixBase<Rhs> &B, MatrixBase<Dest> &dest) const |
| 208 | { |
| 209 | eigen_assert(m_isInitialized && "The factorization should be called first, use compute()"); |
| 210 | eigen_assert(this->rows() == B.rows() && "SparseQR::solve() : invalid number of rows in the right hand side matrix"); |
| 211 | |
| 212 | Index rank = this->rank(); |
| 213 | |
| 214 | // Compute Q^* * b; |
| 215 | typename Dest::PlainObject y, b; |
| 216 | y = this->matrixQ().adjoint() * B; |
| 217 | b = y; |
| 218 | |
| 219 | // Solve with the triangular matrix R |
| 220 | y.resize((std::max<Index>)(cols(),y.rows()),y.cols()); |
| 221 | y.topRows(rank) = this->matrixR().topLeftCorner(rank, rank).template triangularView<Upper>().solve(b.topRows(rank)); |
| 222 | y.bottomRows(y.rows()-rank).setZero(); |
| 223 | |
| 224 | // Apply the column permutation |
| 225 | if (m_perm_c.size()) dest = colsPermutation() * y.topRows(cols()); |
| 226 | else dest = y.topRows(cols()); |
| 227 | |
| 228 | m_info = Success; |
| 229 | return true; |
| 230 | } |
| 231 | |
| 232 | /** Sets the threshold that is used to determine linearly dependent columns during the factorization. |
| 233 | * |