delassus-operator-base.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2024 INRIA
3 //
4 
5 #ifndef __pinocchio_algorithm_delassus_operator_base_hpp__
6 #define __pinocchio_algorithm_delassus_operator_base_hpp__
7 
10 
11 namespace pinocchio
12 {
13 
14  template<typename DelassusOperatorDerived>
16  {
20 
21  DelassusOperatorDerived & derived()
22  {
23  return static_cast<DelassusOperatorDerived &>(*this);
24  }
25  const DelassusOperatorDerived & derived() const
26  {
27  return static_cast<const DelassusOperatorDerived &>(*this);
28  }
29 
30  explicit DelassusOperatorBase(const Eigen::DenseIndex size)
32  {
33  }
34 
36  const bool reset = true, const int max_it = 10, const Scalar rel_tol = Scalar(1e-8)) const
37  {
39  power_iteration_algo.rel_tol = rel_tol;
40  if (reset)
42 
44 
46  }
47 
48  template<typename VectorLike>
50  const Eigen::PlainObjectBase<VectorLike> & largest_eigenvector_est,
51  const bool reset = true,
52  const int max_it = 10,
53  const Scalar rel_tol = Scalar(1e-8)) const
54  {
55  PINOCCHIO_CHECK_ARGUMENT_SIZE(largest_eigenvector_est.size(), size());
57  power_iteration_algo.rel_tol = rel_tol;
58  if (reset)
60  power_iteration_algo.principal_eigen_vector = largest_eigenvector_est;
61 
63 
65  }
66 
68  const bool reset = true,
69  const bool compute_largest = true,
70  const int max_it = 10,
71  const Scalar rel_tol = Scalar(1e-8)) const
72  {
74  power_iteration_algo.rel_tol = rel_tol;
75  if (reset)
77 
78  power_iteration_algo.lowest(derived(), compute_largest);
79 
81  }
82 
83  template<typename VectorLike1, typename VectorLike2>
85  const Eigen::PlainObjectBase<VectorLike1> & largest_eigenvector_est,
86  const Eigen::PlainObjectBase<VectorLike2> & lowest_eigenvector_est,
87  const bool reset = true,
88  const bool compute_largest = true,
89  const int max_it = 10,
90  const Scalar rel_tol = Scalar(1e-8)) const
91  {
92  PINOCCHIO_CHECK_ARGUMENT_SIZE(largest_eigenvector_est.size(), size());
93  PINOCCHIO_CHECK_ARGUMENT_SIZE(lowest_eigenvector_est.size(), size());
94 
96  power_iteration_algo.rel_tol = rel_tol;
97  if (reset)
99  power_iteration_algo.principal_eigen_vector = largest_eigenvector_est;
100  power_iteration_algo.lowest_eigen_vector = lowest_eigenvector_est;
101 
102  power_iteration_algo.lowest(derived(), compute_largest);
103 
105  }
106 
107  template<typename VectorLike>
108  void updateDamping(const Eigen::MatrixBase<VectorLike> & vec)
109  {
110  derived().updateDamping(vec.derived());
111  }
112 
113  void updateDamping(const Scalar mu)
114  {
115  derived().updateDamping(mu);
116  }
117 
118  template<typename MatrixLike>
119  void solveInPlace(const Eigen::MatrixBase<MatrixLike> & mat) const
120  {
121  derived().solveInPlace(mat.const_cast_derived());
122  }
123 
124  template<typename MatrixLike>
125  typename PINOCCHIO_EIGEN_PLAIN_TYPE(MatrixLike)
126  solve(const Eigen::MatrixBase<MatrixLike> & mat) const
127  {
128  return derived().solve(mat);
129  }
130 
131  template<typename MatrixDerivedIn, typename MatrixDerivedOut>
132  void solve(
133  const Eigen::MatrixBase<MatrixDerivedIn> & x,
134  const Eigen::MatrixBase<MatrixDerivedOut> & res) const
135  {
136  derived().solve(x.derived(), res.const_cast_derived());
137  }
138 
139  template<typename MatrixIn, typename MatrixOut>
140  void applyOnTheRight(
141  const Eigen::MatrixBase<MatrixIn> & x, const Eigen::MatrixBase<MatrixOut> & res) const
142  {
143  derived().applyOnTheRight(x.derived(), res.const_cast_derived());
144  }
145 
146  template<typename MatrixDerived>
147  typename PINOCCHIO_EIGEN_PLAIN_TYPE(MatrixDerived)
148  operator*(const Eigen::MatrixBase<MatrixDerived> & x) const
149  {
150  return derived() * x.derived();
151  }
152 
153  Eigen::DenseIndex size() const
154  {
155  return derived().size();
156  }
157  Eigen::DenseIndex rows() const
158  {
159  return derived().rows();
160  }
161  Eigen::DenseIndex cols() const
162  {
163  return derived().cols();
164  }
165 
167  {
168  return power_iteration_algo;
169  }
170 
172  {
173  return power_iteration_algo;
174  }
175 
176  protected:
178 
179  }; // struct DelassusOperatorBase
180 
181 } // namespace pinocchio
182 
183 #endif // ifndef __pinocchio_algorithm_delassus_operator_base_hpp__
PINOCCHIO_CHECK_ARGUMENT_SIZE
#define PINOCCHIO_CHECK_ARGUMENT_SIZE(...)
Macro to check if the size of an element is equal to the expected size.
Definition: include/pinocchio/macros.hpp:216
pinocchio::PowerIterationAlgoTpl::principal_eigen_vector
Vector principal_eigen_vector
Definition: eigenvalues.hpp:120
pinocchio::DelassusOperatorBase::computeLargestEigenValue
Scalar computeLargestEigenValue(const Eigen::PlainObjectBase< VectorLike > &largest_eigenvector_est, const bool reset=true, const int max_it=10, const Scalar rel_tol=Scalar(1e-8)) const
Definition: delassus-operator-base.hpp:49
pinocchio::PowerIterationAlgoTpl::lowest_eigen_vector
Vector lowest_eigen_vector
Definition: eigenvalues.hpp:121
pinocchio::DelassusOperatorBase
Definition: delassus-operator-base.hpp:15
pinocchio::DelassusOperatorBase::getPowerIterationAlgo
const PowerIterationAlgo & getPowerIterationAlgo() const
Definition: delassus-operator-base.hpp:171
pinocchio::DelassusOperatorBase::computeLowestEigenValue
Scalar computeLowestEigenValue(const Eigen::PlainObjectBase< VectorLike1 > &largest_eigenvector_est, const Eigen::PlainObjectBase< VectorLike2 > &lowest_eigenvector_est, const bool reset=true, const bool compute_largest=true, const int max_it=10, const Scalar rel_tol=Scalar(1e-8)) const
Definition: delassus-operator-base.hpp:84
pinocchio::PowerIterationAlgoTpl::largest_eigen_value
Scalar largest_eigen_value
Definition: eigenvalues.hpp:122
rows
int rows
vec
vec
pinocchio::DelassusOperatorBase::PowerIterationAlgo
PowerIterationAlgoTpl< Vector > PowerIterationAlgo
Definition: delassus-operator-base.hpp:19
pinocchio::res
ReturnType res
Definition: spatial/classic-acceleration.hpp:57
pinocchio::DelassusOperatorBase::computeLowestEigenValue
Scalar computeLowestEigenValue(const bool reset=true, const bool compute_largest=true, const int max_it=10, const Scalar rel_tol=Scalar(1e-8)) const
Definition: delassus-operator-base.hpp:67
pinocchio::operator*
TridiagonalSymmetricMatrixApplyOnTheLeftReturnType< LhsMatrixType, TridiagonalSymmetricMatrixTpl< S, O > > operator*(const Eigen::MatrixBase< LhsMatrixType > &lhs, const TridiagonalSymmetricMatrixTpl< S, O > &rhs)
Definition: math/tridiagonal-matrix.hpp:319
pinocchio::DelassusOperatorBase::derived
const DelassusOperatorDerived & derived() const
Definition: delassus-operator-base.hpp:25
pinocchio::DelassusOperatorBase::PINOCCHIO_EIGEN_PLAIN_TYPE
PINOCCHIO_EIGEN_PLAIN_TYPE(MatrixLike) solve(const Eigen
Definition: delassus-operator-base.hpp:125
pinocchio::DelassusOperatorBase::computeLargestEigenValue
Scalar computeLargestEigenValue(const bool reset=true, const int max_it=10, const Scalar rel_tol=Scalar(1e-8)) const
Definition: delassus-operator-base.hpp:35
pinocchio::cholesky::solve
Mat & solve(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< Mat > &y)
Return the solution of using the Cholesky decomposition stored in data given the entry ....
pinocchio::PowerIterationAlgoTpl< Vector >
pinocchio::DelassusOperatorBase::power_iteration_algo
PowerIterationAlgo power_iteration_algo
Definition: delassus-operator-base.hpp:177
pinocchio::DelassusOperatorBase::DelassusOperatorBase
DelassusOperatorBase(const Eigen::DenseIndex size)
Definition: delassus-operator-base.hpp:30
mat
mat
size
FCL_REAL size() const
x
x
pinocchio::PowerIterationAlgoTpl::lowest_eigen_value
Scalar lowest_eigen_value
Definition: eigenvalues.hpp:123
pinocchio::DelassusOperatorBase::updateDamping
void updateDamping(const Scalar mu)
Definition: delassus-operator-base.hpp:113
pinocchio::PowerIterationAlgoTpl::rel_tol
Scalar rel_tol
Definition: eigenvalues.hpp:126
mu
double mu
Definition: delassus.cpp:58
pinocchio::DelassusOperatorBase::updateDamping
void updateDamping(const Eigen::MatrixBase< VectorLike > &vec)
Definition: delassus-operator-base.hpp:108
pinocchio::PowerIterationAlgoTpl::lowest
void lowest(const MatrixLike &mat, const bool compute_largest=true)
Definition: eigenvalues.hpp:68
pinocchio::PowerIterationAlgoTpl::run
void run(const MatrixLike &mat)
Definition: eigenvalues.hpp:35
pinocchio::DelassusOperatorBase::derived
DelassusOperatorDerived & derived()
Definition: delassus-operator-base.hpp:21
fwd.hpp
pinocchio::DelassusOperatorBase::Vector
traits< DelassusOperatorDerived >::Vector Vector
Definition: delassus-operator-base.hpp:18
cols
int cols
pinocchio::traits
Common traits structure to fully define base classes for CRTP.
Definition: fwd.hpp:71
pinocchio::PowerIterationAlgoTpl::max_it
int max_it
Definition: eigenvalues.hpp:124
pinocchio::DelassusOperatorBase::Scalar
traits< DelassusOperatorDerived >::Scalar Scalar
Definition: delassus-operator-base.hpp:17
eigenvalues.hpp
pinocchio::PowerIterationAlgoTpl::reset
void reset()
Definition: eigenvalues.hpp:110
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::DelassusOperatorBase::solveInPlace
void solveInPlace(const Eigen::MatrixBase< MatrixLike > &mat) const
Definition: delassus-operator-base.hpp:119


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:28