Go to the documentation of this file.
5 #ifndef __pinocchio_math_lanczos_decomposition_hpp__
6 #define __pinocchio_math_lanczos_decomposition_hpp__
17 template<
typename _Matrix>
20 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
32 template<
typename MatrixLikeType>
35 ,
m_Ts(decomposition_size)
41 decomposition_size >= 1,
"The size of the decomposition should be greater than one.");
43 decomposition_size <=
mat.rows(),
44 "The size of the decomposition should not be larger than the number of rows.");
58 return !(*
this == other);
66 template<
typename MatrixLikeType>
71 A.rows() ==
m_Qs.rows(),
"The input matrix is of correct size.");
73 const Eigen::DenseIndex decomposition_size =
m_Ts.
cols();
80 for (k = 0; k < decomposition_size; ++k)
82 const auto q =
m_Qs.col(k);
86 if (k < decomposition_size - 1)
101 if (betas[k] <= 1e2 * Eigen::NumTraits<Scalar>::epsilon())
122 template<
typename MatrixLikeType>
125 const Eigen::DenseIndex last_col_id =
m_Ts.
cols() - 1;
129 PlainMatrix residual =
A *
m_Qs;
132 const auto &
q =
m_Qs.col(last_col_id);
135 tmp_vec.noalias() =
A *
q;
136 tmp_vec -= alphas[last_col_id] *
q;
138 tmp_vec -= betas[last_col_id - 1] *
m_Qs.col(last_col_id - 1);
140 residual.col(last_col_id) -= tmp_vec;
157 const PlainMatrix &
Qs()
const
181 #endif // ifndef __pinocchio_math_lanczos_decomposition_hpp__
CoeffVectorType & subDiagonal()
#define PINOCCHIO_CHECK_INPUT_ARGUMENT(...)
Macro to check an assert-like condition and throw a std::invalid_argument exception (with a message) ...
TridiagonalMatrix & Ts()
Returns the tridiagonal matrix associated with the Lanczos decomposition.
Eigen::DenseIndex rank() const
Returns the rank of the decomposition.
TridiagonalSymmetricMatrixTpl< Scalar, Options > TridiagonalMatrix
bool operator==(const LanczosDecompositionTpl &other) const
Compute the largest eigenvalues and the associated principle eigenvector via power iteration.
bool operator!=(const LanczosDecompositionTpl &other) const
const PlainMatrix & Qs() const
Returns the orthogonal basis associated with the Lanczos decomposition.
CoeffVectorType & diagonal()
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef PINOCCHIO_EIGEN_PLAIN_TYPE(_Matrix) PlainMatrix
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
PlainMatrix computeDecompositionResidual(const MatrixLikeType &A) const
Computes the residual associated with the decomposition, namely, the quantity .
void orthonormalisation(const Eigen::MatrixBase< MatrixType > &basis, const Eigen::MatrixBase< VectorType > &vec_)
Perform the Gram-Schmidt orthonormalisation on the input/output vector for a given input basis.
PlainMatrix & Qs()
Returns the orthogonal basis associated with the Lanczos decomposition.
void compute(const MatrixLikeType &A)
Computes the Lanczos decomposition of the input matrix A.
const TridiagonalMatrix & Ts() const
Returns the tridiagonal matrix associated with the Lanczos decomposition.
LanczosDecompositionTpl(const MatrixLikeType &mat, const Eigen::DenseIndex decomposition_size)
Default constructor for the Lanczos decomposition from an input matrix.
AD< Scalar > max(const AD< Scalar > &x, const AD< Scalar > &y)
EIGEN_CONSTEXPR Eigen::Index cols() const EIGEN_NOEXCEPT
Main pinocchio namespace.
pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:31