mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-16 11:23:14 +08:00
Added some minor comments.
Adapted some of the doc/snippets.
This commit is contained in:
parent
a33b2dfeb3
commit
c0b2aa0ace
@ -35,6 +35,9 @@
|
|||||||
template <typename Derived, typename OtherDerived = Derived, bool IsVector = static_cast<bool>(Derived::IsVectorAtCompileTime)> struct ei_conservative_resize_like_impl;
|
template <typename Derived, typename OtherDerived = Derived, bool IsVector = static_cast<bool>(Derived::IsVectorAtCompileTime)> struct ei_conservative_resize_like_impl;
|
||||||
template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers> struct ei_matrix_swap_impl;
|
template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers> struct ei_matrix_swap_impl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Dense storage base class for matrices and arrays.
|
||||||
|
**/
|
||||||
template<typename Derived, template<typename> class _Base, int _Options>
|
template<typename Derived, template<typename> class _Base, int _Options>
|
||||||
class DenseStorageBase : public _Base<Derived>
|
class DenseStorageBase : public _Base<Derived>
|
||||||
{
|
{
|
||||||
@ -450,7 +453,8 @@ class DenseStorageBase : public _Base<Derived>
|
|||||||
resizeLike(other);
|
resizeLike(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \internal Copies the value of the expression \a other into \c *this with automatic resizing.
|
/**
|
||||||
|
* \brief Copies the value of the expression \a other into \c *this with automatic resizing.
|
||||||
*
|
*
|
||||||
* *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized),
|
* *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized),
|
||||||
* it will be initialized.
|
* it will be initialized.
|
||||||
@ -460,6 +464,8 @@ class DenseStorageBase : public _Base<Derived>
|
|||||||
* remain row-vectors and vectors remain vectors.
|
* remain row-vectors and vectors remain vectors.
|
||||||
*
|
*
|
||||||
* \sa operator=(const MatrixBase<OtherDerived>&), _set_noalias()
|
* \sa operator=(const MatrixBase<OtherDerived>&), _set_noalias()
|
||||||
|
*
|
||||||
|
* \internal
|
||||||
*/
|
*/
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE Derived& _set(const DenseBase<OtherDerived>& other)
|
EIGEN_STRONG_INLINE Derived& _set(const DenseBase<OtherDerived>& other)
|
||||||
|
@ -152,8 +152,13 @@ class Matrix
|
|||||||
using Base::coeff;
|
using Base::coeff;
|
||||||
using Base::coeffRef;
|
using Base::coeffRef;
|
||||||
|
|
||||||
/** This is a special case of the templated operator=. Its purpose is to
|
/**
|
||||||
* prevent a default operator= from hiding the templated operator=.
|
* \brief Assigns matrices to each other.
|
||||||
|
*
|
||||||
|
* \note This is a special case of the templated operator=. Its purpose is
|
||||||
|
* to prevent a default operator= from hiding the templated operator=.
|
||||||
|
*
|
||||||
|
* \callgraph
|
||||||
*/
|
*/
|
||||||
EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other)
|
EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other)
|
||||||
{
|
{
|
||||||
|
@ -4,5 +4,5 @@ A << 1,2,3, 0,5,6, 0,0,10;
|
|||||||
b << 3, 3, 4;
|
b << 3, 3, 4;
|
||||||
cout << "Here is the matrix A:" << endl << A << endl;
|
cout << "Here is the matrix A:" << endl << A << endl;
|
||||||
cout << "Here is the vector b:" << endl << b << endl;
|
cout << "Here is the vector b:" << endl << b << endl;
|
||||||
Vector3f x = A.triangularView<UpperTriangular>().solve(b);
|
Vector3f x = A.triangularView<Upper>().solve(b);
|
||||||
cout << "The solution is:" << endl << x << endl;
|
cout << "The solution is:" << endl << x << endl;
|
||||||
|
@ -2,5 +2,5 @@ Matrix3f A;
|
|||||||
Vector3f b;
|
Vector3f b;
|
||||||
A << 1,2,3, 0,5,6, 0,0,10;
|
A << 1,2,3, 0,5,6, 0,0,10;
|
||||||
b << 3, 3, 4;
|
b << 3, 3, 4;
|
||||||
A.triangularView<UpperTriangular>().solveInPlace(b);
|
A.triangularView<Upper>().solveInPlace(b);
|
||||||
cout << "The solution is:" << endl << b << endl;
|
cout << "The solution is:" << endl << b << endl;
|
||||||
|
@ -7,10 +7,10 @@ cout << "Here is, up to permutations, its LU decomposition matrix:"
|
|||||||
<< endl << lu.matrixLU() << endl;
|
<< endl << lu.matrixLU() << endl;
|
||||||
cout << "Here is the L part:" << endl;
|
cout << "Here is the L part:" << endl;
|
||||||
Matrix5x5 l = Matrix5x5::Identity();
|
Matrix5x5 l = Matrix5x5::Identity();
|
||||||
l.block<5,3>(0,0).part<StrictlyLowerTriangular>() = lu.matrixLU();
|
l.block<5,3>(0,0).part<StrictlyLower>() = lu.matrixLU();
|
||||||
cout << l << endl;
|
cout << l << endl;
|
||||||
cout << "Here is the U part:" << endl;
|
cout << "Here is the U part:" << endl;
|
||||||
Matrix5x3 u = lu.matrixLU().part<UpperTriangular>();
|
Matrix5x3 u = lu.matrixLU().part<Upper>();
|
||||||
cout << u << endl;
|
cout << u << endl;
|
||||||
cout << "Let us now reconstruct the original matrix m:" << endl;
|
cout << "Let us now reconstruct the original matrix m:" << endl;
|
||||||
cout << lu.permutationP().inverse() * l * u * lu.permutationQ().inverse() << endl;
|
cout << lu.permutationP().inverse() * l * u * lu.permutationQ().inverse() << endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user