42 typedef Eigen::LLT<Matrix> CholeskyDecomposition;
45 template<
typename MatrixDerived>
48 , delassus_matrix(
mat)
49 , mat_tmp(
mat.rows(),
mat.cols())
51 , damping(Vector::Zero(
mat.rows()))
53 PINOCCHIO_CHECK_ARGUMENT_SIZE(
mat.rows(),
mat.cols());
56 template<
typename VectorLike>
57 void updateDamping(
const Eigen::MatrixBase<VectorLike> &
vec)
60 mat_tmp = delassus_matrix;
61 mat_tmp +=
vec.asDiagonal();
65 void updateDamping(
const Scalar & mu)
67 updateDamping(Vector::Constant(size(), mu));
70 template<
typename MatrixLike>
71 void solveInPlace(
const Eigen::MatrixBase<MatrixLike> &
mat)
const
73 llt.solveInPlace(
mat.const_cast_derived());
76 template<
typename MatrixLike>
77 typename PINOCCHIO_EIGEN_PLAIN_TYPE(
MatrixLike)
78 solve(
const Eigen::MatrixBase<MatrixLike> &
mat)
const
85 template<
typename MatrixDerivedIn,
typename MatrixDerivedOut>
87 const Eigen::MatrixBase<MatrixDerivedIn> & x,
88 const Eigen::MatrixBase<MatrixDerivedOut> & res)
const
90 res.const_cast_derived() = x;
91 solveInPlace(res.const_cast_derived());
94 template<
typename MatrixIn,
typename MatrixOut>
96 const Eigen::MatrixBase<MatrixIn> & x,
const Eigen::MatrixBase<MatrixOut> &
res_)
const
99 res.noalias() = delassus_matrix * x;
100 res.array() += damping.array() * x.array();
103 template<
typename MatrixDerived>
105 operator*(
const Eigen::MatrixBase<MatrixDerived> & x)
const
107 typedef typename PINOCCHIO_EIGEN_PLAIN_TYPE(
MatrixDerived) ReturnType;
109 PINOCCHIO_CHECK_ARGUMENT_SIZE(x.rows(), size());
110 ReturnType res(x.rows(), x.cols());
111 applyOnTheRight(x, res);
115 Eigen::DenseIndex size()
const
117 return delassus_matrix.rows();
119 Eigen::DenseIndex rows()
const
121 return delassus_matrix.rows();
123 Eigen::DenseIndex cols()
const
125 return delassus_matrix.cols();
130 mat_tmp = delassus_matrix;
131 mat_tmp += damping.asDiagonal();
137 Matrix res = Matrix::Identity(size(), size());
138 llt.solveInPlace(res);
145 CholeskyDecomposition llt;