MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / _solve_impl

Method _solve_impl

include/Eigen/Eigen/src/SparseQR/SparseQR.h:207–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 *

Callers

nothing calls this directly

Calls 11

rowsMethod · 0.95
rankMethod · 0.95
matrixQMethod · 0.95
matrixRMethod · 0.80
colsFunction · 0.50
adjointMethod · 0.45
resizeMethod · 0.45
colsMethod · 0.45
solveMethod · 0.45
setZeroMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected