16 template <
typename t_Scalar,
int t_primal_size>
20 Eigen::Matrix<t_Scalar, t_primal_size, t_primal_size>
QLi_aka_J;
21 Eigen::Matrix<t_Scalar, t_primal_size, Eigen::Dynamic == t_primal_size ? Eigen::Dynamic : t_primal_size + 1>
R;
23 #ifdef QPMAD_USE_HOUSEHOLDER
24 Eigen::Matrix<t_Scalar, t_primal_size, t_primal_size> householder_workspace_;
32 QLi_aka_J.resize(primal_size, primal_size);
33 R.resize(primal_size, primal_size + 1);
34 #ifdef QPMAD_USE_HOUSEHOLDER
35 householder_workspace_.resize(primal_size, primal_size);
40 template <
class t_MatrixType>
45 const bool return_inverted_cholesky_factor)
49 QLi_aka_J.template triangularView<Eigen::StrictlyLower>().setZero();
54 if (return_inverted_cholesky_factor)
56 H.template triangularView<Eigen::Upper>() =
QLi_aka_J.template triangularView<Eigen::Upper>();
61 QLi_aka_J.template triangularView<Eigen::Upper>() = H.template triangularView<Eigen::Upper>();
75 #ifdef QPMAD_USE_HOUSEHOLDER
80 const double tolerance)
82 #ifdef QPMAD_USE_HOUSEHOLDER
88 R(R_col, R_col) = beta;
91 .applyHouseholderOnTheLeft(
94 householder_workspace_.data());
103 return (std::abs(beta) > tolerance);
111 for (j = i - 1; (0.0 ==
R(j, R_col)) && (j > R_col); --j)
128 return (std::abs(
R(R_col, R_col)) > tolerance);
136 for (
MatrixIndex i = R_col_index + 1; i < R_cols; ++i)
143 R.col(i - 1).segment(0, i) =
R.col(i).segment(0, i);
146 R.col(R_cols - 1) =
R.col(R_cols);
150 template <
class t_VectorType>
152 t_VectorType &step_direction,
157 R.col(active_set_size) =
QLi_aka_J.row(simple_bound_index).transpose();
163 template <
class t_VectorType,
class t_RowVectorType>
165 t_VectorType &step_direction,
166 const t_RowVectorType &ctr,
170 R.col(active_set_size).noalias() =
QLi_aka_J.transpose() * ctr.transpose();
176 template <
class t_VectorType0,
class t_ActiveSet>
184 template <
class t_VectorType,
class t_MatrixType,
class t_ActiveSet>
186 t_VectorType &dual_step_direction,
188 const t_MatrixType &A,
189 const t_ActiveSet &active_set)
212 R.col(active_set.size_).noalias() =
217 R.col(active_set.size_).noalias() =
227 template <
class t_VectorType0,
class t_VectorType1,
class t_ActiveSet>
229 t_VectorType0 &primal_step_direction,
230 t_VectorType1 &dual_step_direction,
231 const t_ActiveSet &active_set)
233 primal_step_direction.noalias() -=
QLi_aka_J.col(active_set.size_) *
R(active_set.size_, active_set.size_);
238 template <
class t_VectorType0,
class t_VectorType1,
class t_ActiveSet>
240 t_VectorType0 &primal_step_direction,
241 t_VectorType1 &dual_step_direction,
242 const t_ActiveSet &active_set)
244 primal_step_direction.noalias() = -
QLi_aka_J.col(active_set.size_) *
R(active_set.size_, active_set.size_);
250 template <
class t_VectorType>
253 step_direction.noalias() =
259 template <
class t_VectorType,
class t_ActiveSet>
262 step_direction.segment(active_set.num_equalities_, active_set.num_inequalities_) =
263 -
R.col(active_set.size_).segment(active_set.num_equalities_, active_set.num_inequalities_);
264 R.block(active_set.num_equalities_,
265 active_set.num_equalities_,
266 active_set.num_inequalities_,
267 active_set.num_inequalities_)
268 .template triangularView<Eigen::Upper>()
269 .solveInPlace(step_direction.segment(active_set.num_equalities_, active_set.num_inequalities_));
MatrixIndex general_constraint_index_
void updateStepsAfterPureDualStep(t_VectorType0 &primal_step_direction, t_VectorType1 &dual_step_direction, const t_ActiveSet &active_set)
Eigen::Matrix< t_Scalar, t_primal_size, t_primal_size > QLi_aka_J
void computeInequalityDualStep(t_VectorType &dual_step_direction, const ChosenConstraint &chosen_ctr, const t_MatrixType &A, const t_ActiveSet &active_set)
void computeEqualityPrimalStep(t_VectorType &step_direction, const MatrixIndex simple_bound_index, const MatrixIndex active_set_size)
MatrixIndex length_nonzero_head_d_
void reserve(const MatrixIndex primal_size)
void computeInequalityPrimalStep(t_VectorType0 &primal_step_direction, const t_ActiveSet &active_set)
void updateStepsAfterPartialStep(t_VectorType0 &primal_step_direction, t_VectorType1 &dual_step_direction, const t_ActiveSet &active_set)
void computePrimalStepDirection(t_VectorType &step_direction, const MatrixIndex active_set_size)
void downdate(const MatrixIndex R_col_index, const MatrixIndex R_cols)
void initialize(t_MatrixType &H, const SolverParameters::HessianType hessian_type, const MatrixIndex primal_size, const bool return_inverted_cholesky_factor)
Eigen::Matrix< t_Scalar, t_primal_size, Eigen::Dynamic==t_primal_size ? Eigen::Dynamic :t_primal_size+1 > R
void computeDualStepDirection(t_VectorType &step_direction, const t_ActiveSet &active_set)
void computeEqualityPrimalStep(t_VectorType &step_direction, const t_RowVectorType &ctr, const MatrixIndex active_set_size)
bool update(const MatrixIndex R_col, const bool is_simple, const double tolerance)
Represents Givens rotation.
void applyRowWise(t_MatrixType &M, MatrixIndex start, MatrixIndex end, MatrixIndex row_1, MatrixIndex row_2) const
Type computeAndApply(t_Scalar &a, t_Scalar &b, const t_Scalar eps)
void applyColumnWise(t_MatrixType &M, MatrixIndex start, MatrixIndex end, MatrixIndex column_1, MatrixIndex column_2) const
@ HESSIAN_INVERTED_CHOLESKY_FACTOR
@ HESSIAN_CHOLESKY_FACTOR
static void compute(t_OutputMatrixType &U_inverse, const t_InputMatrixType &L)
#define QPMAD_UTILS_THROW(s)
EIGEN_DEFAULT_DENSE_INDEX_TYPE MatrixIndex