mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add cholesky's members to MatrixBase
Various documentation improvements including new snippets (AngleAxis and Cholesky)
This commit is contained in:
@@ -66,7 +66,7 @@ template<typename MatrixType> class Cholesky
|
||||
bool isPositiveDefinite(void) const { return m_isPositiveDefinite; }
|
||||
|
||||
template<typename Derived>
|
||||
typename Derived::Eval solve(MatrixBase<Derived> &b);
|
||||
typename Derived::Eval solve(const MatrixBase<Derived> &b) const;
|
||||
|
||||
void compute(const MatrixType& matrix);
|
||||
|
||||
@@ -110,10 +110,14 @@ void Cholesky<MatrixType>::compute(const MatrixType& a)
|
||||
/** \returns the solution of A x = \a b using the current decomposition of A.
|
||||
* In other words, it returns \code A^-1 b \endcode computing
|
||||
* \code L^-* L^1 b \endcode from right to left.
|
||||
*
|
||||
* Example: \include Cholesky_solve.cpp
|
||||
* Output: \verbinclude Cholesky_solve.out
|
||||
*
|
||||
*/
|
||||
template<typename MatrixType>
|
||||
template<typename Derived>
|
||||
typename Derived::Eval Cholesky<MatrixType>::solve(MatrixBase<Derived> &b)
|
||||
typename Derived::Eval Cholesky<MatrixType>::solve(const MatrixBase<Derived> &b) const
|
||||
{
|
||||
const int size = m_matrix.rows();
|
||||
ei_assert(size==b.size());
|
||||
@@ -121,5 +125,14 @@ typename Derived::Eval Cholesky<MatrixType>::solve(MatrixBase<Derived> &b)
|
||||
return m_matrix.adjoint().template extract<Upper>().inverseProduct(matrixL().inverseProduct(b));
|
||||
}
|
||||
|
||||
/** \cholesky_module
|
||||
* \returns the Cholesky decomposition of \c *this
|
||||
*/
|
||||
template<typename Derived>
|
||||
inline const Cholesky<typename ei_eval<Derived>::type>
|
||||
MatrixBase<Derived>::cholesky() const
|
||||
{
|
||||
return Cholesky<typename ei_eval<Derived>::type>(derived());
|
||||
}
|
||||
|
||||
#endif // EIGEN_CHOLESKY_H
|
||||
|
||||
@@ -77,7 +77,7 @@ template<typename MatrixType> class CholeskyWithoutSquareRoot
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
typename Derived::Eval solve(MatrixBase<Derived> &b);
|
||||
typename Derived::Eval solve(const MatrixBase<Derived> &b) const;
|
||||
|
||||
void compute(const MatrixType& matrix);
|
||||
|
||||
@@ -127,7 +127,7 @@ void CholeskyWithoutSquareRoot<MatrixType>::compute(const MatrixType& a)
|
||||
*/
|
||||
template<typename MatrixType>
|
||||
template<typename Derived>
|
||||
typename Derived::Eval CholeskyWithoutSquareRoot<MatrixType>::solve(MatrixBase<Derived> &vecB)
|
||||
typename Derived::Eval CholeskyWithoutSquareRoot<MatrixType>::solve(const MatrixBase<Derived> &vecB) const
|
||||
{
|
||||
const int size = m_matrix.rows();
|
||||
ei_assert(size==vecB.size());
|
||||
@@ -140,5 +140,14 @@ typename Derived::Eval CholeskyWithoutSquareRoot<MatrixType>::solve(MatrixBase<D
|
||||
);
|
||||
}
|
||||
|
||||
/** \cholesky_module
|
||||
* \returns the Cholesky decomposition without square root of \c *this
|
||||
*/
|
||||
template<typename Derived>
|
||||
inline const CholeskyWithoutSquareRoot<typename ei_eval<Derived>::type>
|
||||
MatrixBase<Derived>::choleskyNoSqrt() const
|
||||
{
|
||||
return derived();
|
||||
}
|
||||
|
||||
#endif // EIGEN_CHOLESKY_WITHOUT_SQUARE_ROOT_H
|
||||
|
||||
@@ -532,6 +532,10 @@ template<typename Derived> class MatrixBase
|
||||
void computeInverse(typename ei_eval<Derived>::type *result) const;
|
||||
Scalar determinant() const;
|
||||
|
||||
/////////// Cholesky module ///////////
|
||||
|
||||
const Cholesky<typename ei_eval<Derived>::type> cholesky() const;
|
||||
const CholeskyWithoutSquareRoot<typename ei_eval<Derived>::type> choleskyNoSqrt() const;
|
||||
|
||||
/////////// QR module ///////////
|
||||
|
||||
|
||||
@@ -96,6 +96,8 @@ void ei_cache_friendly_product(
|
||||
|
||||
template<typename ExpressionType, bool CheckExistence = true> class Inverse;
|
||||
template<typename MatrixType> class QR;
|
||||
template<typename MatrixType> class Cholesky;
|
||||
template<typename MatrixType> class CholeskyWithoutSquareRoot;
|
||||
|
||||
// Geometry module:
|
||||
template<typename Lhs, typename Rhs> class Cross;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
*
|
||||
* \class AngleAxis
|
||||
*
|
||||
* \brief Represents a 3D rotation as a rotation angle around an arbitray 3D axis
|
||||
* \brief Represents a 3D rotation as a rotation angle around an arbitrary 3D axis
|
||||
*
|
||||
* \param _Scalar the scalar type, i.e., the type of the coefficients.
|
||||
*
|
||||
@@ -37,7 +37,14 @@
|
||||
* \li \c AngleAxisf for \c float
|
||||
* \li \c AngleAxisd for \c double
|
||||
*
|
||||
* \sa class Quaternion, class Transform
|
||||
* \addexample AngleAxisForEuler \label How to define a rotation from Euler-angles
|
||||
*
|
||||
* Combined with MatrixBase::Unit{X,Y,Z}, AngleAxis can be used to easily
|
||||
* mimic Euler-angles. Here is an example:
|
||||
* \include AngleAxis_mimic_euler.cpp
|
||||
* Output: \verbinclude AngleAxis_mimic_euler.out
|
||||
*
|
||||
* \sa class Quaternion, class Transform, MatrixBase::UnitX()
|
||||
*/
|
||||
template<typename _Scalar>
|
||||
class AngleAxis
|
||||
|
||||
Reference in New Issue
Block a user