5#ifdef ALIGATOR_WITH_CHOLMOD
6#include <Eigen/CholmodSupport>
14template <
typename _Scalar>
class CholmodLqSolver {
16 using Scalar = _Scalar;
18 using Problem = LQRProblemTpl<Scalar>;
19 using SparseType = Eigen::SparseMatrix<Scalar>;
20 using Triplet = Eigen::Triplet<Scalar>;
22 explicit CholmodLqSolver(
const Problem &problem, uint numRefinementSteps = 1);
24 bool backward(
const Scalar mudyn,
const Scalar mueq);
26 bool forward(std::vector<VectorXs> &xs, std::vector<VectorXs> &us,
27 std::vector<VectorXs> &vs, std::vector<VectorXs> &lbdas)
const;
29 inline Scalar computeSparseResidual()
const {
31 kktResidual.noalias() += kktMatrix * kktSol;
32 return math::infty_norm(kktResidual);
40 mutable VectorXs kktResidual;
42 mutable VectorXs kktSol;
43 Eigen::CholmodSimplicialLDLT<SparseType> cholmod;
45 uint numRefinementSteps;
48 const Problem *problem_;
51#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
52extern template class CholmodLqSolver<context::Scalar>;
#define ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)