5 #ifndef __pinocchio_math_eigenvalues_hpp__
6 #define __pinocchio_math_eigenvalues_hpp__
16 template<
typename _Vector>
34 template<
typename MatrixLike>
35 void run(
const MatrixLike & mat)
43 const Scalar eigenvalue_est_prev = eigenvalue_est;
51 if (check_expression_if_real<Scalar, false>(
53 <=
rel_tol *
math::max(math::fabs(eigenvalue_est_prev), math::fabs(eigenvalue_est))))
60 template<
typename MatrixLike,
typename VectorLike>
61 void run(
const MatrixLike & mat,
const Eigen::PlainObjectBase<VectorLike> & eigenvector_est)
67 template<
typename MatrixLike>
68 void lowest(
const MatrixLike & mat,
const bool compute_largest =
true)
80 const Scalar eigenvalue_est_prev = eigenvalue_est;
89 if (check_expression_if_real<Scalar, false>(
91 <=
rel_tol *
math::max(math::fabs(eigenvalue_est_prev), math::fabs(eigenvalue_est))))
98 template<
typename MatrixLike,
typename VectorLike>
100 const MatrixLike & mat,
101 const Eigen::PlainObjectBase<VectorLike> & largest_eigenvector_est,
102 const Eigen::PlainObjectBase<VectorLike> & lowest_eigenvector_est,
103 const bool compute_largest =
true)
137 template<
typename MatrixLike,
typename VectorLike>
139 const MatrixLike & mat,
140 const Eigen::PlainObjectBase<VectorLike> & _eigenvector_est,
141 const int max_it = 10,
145 algo.
run(
mat, _eigenvector_est.derived());
152 template<
typename MatrixLike>
153 Eigen::Matrix<typename MatrixLike::Scalar, MatrixLike::RowsAtCompileTime, 1>
155 const MatrixLike & mat,
const int max_it = 10,
const typename MatrixLike::Scalar rel_tol = 1e-8)
157 typedef Eigen::Matrix<typename MatrixLike::Scalar, MatrixLike::RowsAtCompileTime, 1> Vector;
167 template<
typename MatrixLike,
typename VectorLike1,
typename VectorLike2>
169 const MatrixLike & mat,
170 const Eigen::PlainObjectBase<VectorLike1> & largest_eigenvector_est,
171 const Eigen::PlainObjectBase<VectorLike2> & lowest_eigenvector_est,
172 const bool compute_largest =
true,
173 const int max_it = 10,
178 mat, largest_eigenvector_est.derived(), lowest_eigenvector_est.derived(), compute_largest);
186 template<
typename MatrixLike>
187 Eigen::Matrix<typename MatrixLike::Scalar, MatrixLike::RowsAtCompileTime, 1>
189 const MatrixLike & mat,
190 const bool compute_largest =
true,
191 const int max_it = 10,
194 typedef Eigen::Matrix<typename MatrixLike::Scalar, MatrixLike::RowsAtCompileTime, 1> Vector;
204 template<
typename VectorLike>
208 return eigenvector.norm();
212 #endif // #ifndef __pinocchio_math_eigenvalues_hpp__