Eigen  5.0.1
 
Loading...
Searching...
No Matches
Eigen::SelfAdjointView< MatrixType_, UpLo > Class Template Reference

#include <Eigen/src/Core/SelfAdjointView.h>

Detailed Description

template<typename MatrixType_, unsigned int UpLo>
class Eigen::SelfAdjointView< MatrixType_, UpLo >

Expression of a selfadjoint matrix from a triangular part of a dense matrix.

Template Parameters
MatrixTypethe type of the dense matrix storing the coefficients
TriangularPartcan be either Lower or Upper

This class is an expression of a selfadjoint matrix from a triangular part of a matrix with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView() and most of the time this is the only way that it is used.

See also
class TriangularBase, MatrixBase::selfadjointView()
+ Inheritance diagram for Eigen::SelfAdjointView< MatrixType_, UpLo >:

Public Types

using EigenvaluesReturnType
 
using RealScalar
 
using Scalar
 The type of coefficients in this matrix.
 
- Public Types inherited from Eigen::TriangularBase< SelfAdjointView< MatrixType_, UpLo > >
- Public Types inherited from Eigen::EigenBase< SelfAdjointView< MatrixType_, UpLo > >
using Index
 The interface type of indices.
 

Public Member Functions

BunchKaufman< PlainObject, UpLo > bunchKaufman () const
 
MatrixType::ConstDiagonalReturnType diagonal () const
 
EigenvaluesReturnType eigenvalues () const
 Computes the eigenvalues of a matrix.
 
RealScalar l1Norm () const
 
LDLT< PlainObject, UpLo > ldlt () const
 
LLT< PlainObject, UpLo > llt () const
 
const Product< SelfAdjointView, Inverse< OtherDerived > > operator* (const InverseImpl< OtherDerived, PermutationStorage > &rhs) const
 
const Product< SelfAdjointView, OtherDerived > operator* (const PermutationBase< OtherDerived > &rhs) const
 
const Product< SelfAdjointView, OtherDerived > operator* (const TriangularBase< OtherDerived > &rhs) const
 
SelfAdjointView & operator*= (const Scalar &other)
 
template<typename OtherDerived>
SelfAdjointView & operator+= (const DenseBase< OtherDerived > &other)
 
template<typename OtherDerived>
SelfAdjointView & operator-= (const DenseBase< OtherDerived > &other)
 
SelfAdjointView & operator/= (const Scalar &other)
 
template<typename OtherDerived>
SelfAdjointView & operator= (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived>
SelfAdjointView & operator= (const TriangularBase< OtherDerived > &other)
 
RealScalar operatorNorm () const
 Computes the L2 operator norm.
 
template<typename DerivedU, typename DerivedV>
SelfAdjointView & rankUpdate (const MatrixBase< DerivedU > &u, const MatrixBase< DerivedV > &v, const Scalar &alpha=Scalar(1))
 
template<typename DerivedU>
SelfAdjointView & rankUpdate (const MatrixBase< DerivedU > &u, const Scalar &alpha=Scalar(1))
 
template<unsigned int TriMode>
std::conditional_t<(TriMode &(Upper|Lower))==(UpLo &(Upper|Lower)), TriangularView< MatrixType, TriMode >, TriangularView< typename MatrixType::AdjointReturnType, TriMode > > triangularView () const
 
- Public Member Functions inherited from Eigen::TriangularBase< SelfAdjointView< MatrixType_, UpLo > >
const AdjointReturnType adjoint () const
 
Scalar coeff (Index row, Index col) const
 
Scalar & coeffRef (Index row, Index col)
 
const ConjugateReturnType conjugate () const
 
std::conditional_t< Cond, ConjugateReturnType, ConstView > conjugateIf () const
 
void copyCoeff (Index row, Index col, Other &other)
 
void evalTo (MatrixBase< DenseDerived > &other) const
 
void evalToLazy (MatrixBase< DenseDerived > &other) const
 
void fill (const Scalar &value)
 
Scalar & operator() (Index row, Index col)
 
Scalar operator() (Index row, Index col) const
 
const Product< SelfAdjointView< MatrixType_, UpLo >, Inverse< OtherDerived > > operator* (const InverseImpl< OtherDerived, PermutationStorage > &rhs) const
 
const Product< SelfAdjointView< MatrixType_, UpLo >, OtherDerived > operator* (const PermutationBase< OtherDerived > &rhs) const
 
const Product< SelfAdjointView< MatrixType_, UpLo >, OtherDerived > operator* (const TriangularBase< OtherDerived > &rhs) const
 
auto operator+ (const DiagonalBase< OtherDerived > &other) const
 
auto operator- (const DiagonalBase< OtherDerived > &other) const
 
SelfAdjointView< MatrixType_, UpLo > & setConstant (const Scalar &value)
 
SelfAdjointView< MatrixType_, UpLo > & setIdentity ()
 
SelfAdjointView< MatrixType_, UpLo > & setOnes ()
 
SelfAdjointView< MatrixType_, UpLo > & setRandom ()
 
SelfAdjointView< MatrixType_, UpLo > & setZero ()
 
TransposeReturnType transpose ()
 
const ConstTransposeReturnType transpose () const
 
- Public Member Functions inherited from Eigen::EigenBase< SelfAdjointView< MatrixType_, UpLo > >
constexpr Index cols () const noexcept
 
constexpr SelfAdjointView< MatrixType_, UpLo > & derived ()
 
constexpr const SelfAdjointView< MatrixType_, UpLo > & derived () const
 
constexpr Index rows () const noexcept
 
constexpr Index size () const noexcept
 

Member Typedef Documentation

◆ EigenvaluesReturnType

template<typename MatrixType_, unsigned int UpLo>
using Eigen::SelfAdjointView< MatrixType_, UpLo >::EigenvaluesReturnType

Return type of eigenvalues()

◆ RealScalar

template<typename MatrixType_, unsigned int UpLo>
using Eigen::SelfAdjointView< MatrixType_, UpLo >::RealScalar

Real part of Scalar

Member Function Documentation

◆ bunchKaufman()

template<typename MatrixType, unsigned int UpLo>
BunchKaufman< typename SelfAdjointView< MatrixType, UpLo >::PlainObject, UpLo > Eigen::SelfAdjointView< MatrixType, UpLo >::bunchKaufman ( ) const
inline

This is defined in the Cholesky module.

#include <Eigen/Cholesky>
Returns
the Bunch-Kaufman factorization of *this
See also
SelfAdjointView::bunchKaufman()

◆ diagonal()

template<typename MatrixType_, unsigned int UpLo>
MatrixType::ConstDiagonalReturnType Eigen::SelfAdjointView< MatrixType_, UpLo >::diagonal ( ) const
inline
Returns
a const expression of the main diagonal of the matrix *this

This method simply returns the diagonal of the nested expression, thus by-passing the SelfAdjointView decorator.

See also
MatrixBase::diagonal(), class Diagonal

◆ eigenvalues()

template<typename MatrixType, unsigned int UpLo>
SelfAdjointView< MatrixType, UpLo >::EigenvaluesReturnType Eigen::SelfAdjointView< MatrixType, UpLo >::eigenvalues ( ) const
inline

Computes the eigenvalues of a matrix.

Returns
Column vector containing the eigenvalues.

This is defined in the Eigenvalues module.

#include <Eigen/Eigenvalues>

This function computes the eigenvalues with the help of the SelfAdjointEigenSolver class. The eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix.

Example:

// SPDX-FileCopyrightText: The Eigen Authors
// SPDX-License-Identifier: MPL-2.0
MatrixXd ones = MatrixXd::Ones(3, 3);
VectorXd eivals = ones.selfadjointView<Lower>().eigenvalues();
cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl;
EigenvaluesReturnType eigenvalues() const
Computes the eigenvalues of a matrix.
Definition MatrixBaseEigenvalues.h:84
@ Lower
Definition Constants.h:212
Matrix< double, Dynamic, Dynamic > MatrixXd
DynamicĂ—Dynamic matrix of type double.
Definition Matrix.h:489
Matrix< double, Dynamic, 1 > VectorXd
DynamicĂ—1 vector of type double.
Definition Matrix.h:489

Output:

The eigenvalues of the 3x3 matrix of ones are:
-2.22e-16
        0
        3
See also
SelfAdjointEigenSolver::eigenvalues(), MatrixBase::eigenvalues()

◆ l1Norm()

template<typename MatrixType_, unsigned int UpLo>
RealScalar Eigen::SelfAdjointView< MatrixType_, UpLo >::l1Norm ( ) const
inline
Returns
the matrix 1-norm (maximum absolute column sum) of the implicit full self-adjoint matrix, reading only the stored triangle. For Hermitian (complex) scalars the unstored entries are conjugates of stored ones, and since |conj(x)| = |x| the result matches the L1 norm of the full matrix.

◆ ldlt()

template<typename MatrixType, unsigned int UpLo>
LDLT< typename SelfAdjointView< MatrixType, UpLo >::PlainObject, UpLo > Eigen::SelfAdjointView< MatrixType, UpLo >::ldlt ( ) const
inline

This is defined in the Cholesky module.

#include <Eigen/Cholesky>
Returns
the Cholesky decomposition with full pivoting without square root of *this
See also
MatrixBase::ldlt()

◆ llt()

template<typename MatrixType, unsigned int UpLo>
LLT< typename SelfAdjointView< MatrixType, UpLo >::PlainObject, UpLo > Eigen::SelfAdjointView< MatrixType, UpLo >::llt ( ) const
inline

This is defined in the Cholesky module.

#include <Eigen/Cholesky>
Returns
the LLT decomposition of *this
See also
SelfAdjointView::llt()

◆ operator*() [1/3]

template<typename MatrixType_, unsigned int UpLo>
const Product< SelfAdjointView, Inverse< OtherDerived > > Eigen::TriangularBase< SelfAdjointView >::operator* ( const InverseImpl< OtherDerived, PermutationStorage > & rhs) const
inline
Returns
the dense matrix expression of *this with the inverse permutation rhs applied to its columns.

◆ operator*() [2/3]

template<typename MatrixType_, unsigned int UpLo>
const Product< SelfAdjointView, OtherDerived > Eigen::TriangularBase< SelfAdjointView >::operator* ( const PermutationBase< OtherDerived > & rhs) const
inline
Returns
the dense matrix expression of *this with the permutation rhs applied to its columns.

◆ operator*() [3/3]

template<typename MatrixType_, unsigned int UpLo>
const Product< SelfAdjointView, OtherDerived > Eigen::TriangularBase< SelfAdjointView >::operator* ( const TriangularBase< OtherDerived > & rhs) const
inline
Returns
the dense matrix product of *this by the triangular or self-adjoint view rhs.

The right factor is evaluated into a dense temporary and the product runs the kernel of *this times a dense matrix. The result is a plain dense expression even when the structure would be preserved, as for two upper triangular factors.

◆ operator*=()

template<typename MatrixType_, unsigned int UpLo>
SelfAdjointView & Eigen::SelfAdjointView< MatrixType_, UpLo >::operator*= ( const Scalar & other)
inline

◆ operator+=()

template<typename MatrixType_, unsigned int UpLo>
template<typename OtherDerived>
SelfAdjointView & Eigen::SelfAdjointView< MatrixType_, UpLo >::operator+= ( const DenseBase< OtherDerived > & other)
inline
See also
MatrixBase::operator+=()

◆ operator-=()

template<typename MatrixType_, unsigned int UpLo>
template<typename OtherDerived>
SelfAdjointView & Eigen::SelfAdjointView< MatrixType_, UpLo >::operator-= ( const DenseBase< OtherDerived > & other)
inline
See also
MatrixBase::operator-=()

◆ operator/=()

template<typename MatrixType_, unsigned int UpLo>
SelfAdjointView & Eigen::SelfAdjointView< MatrixType_, UpLo >::operator/= ( const Scalar & other)
inline
See also
DenseBase::operator/=()

◆ operator=() [1/2]

template<typename MatrixType_, unsigned int UpLo>
template<typename OtherDerived>
SelfAdjointView & Eigen::SelfAdjointView< MatrixType_, UpLo >::operator= ( const MatrixBase< OtherDerived > & other)
inline

Assigns a matrix expression to the referenced triangular part of the selfadjoint matrix.

◆ operator=() [2/2]

template<typename MatrixType_, unsigned int UpLo>
template<typename OtherDerived>
SelfAdjointView & Eigen::SelfAdjointView< MatrixType_, UpLo >::operator= ( const TriangularBase< OtherDerived > & other)
inline

Assigns a triangular or selfadjoint expression without materializing a dense temporary.

◆ operatorNorm()

template<typename MatrixType, unsigned int UpLo>
SelfAdjointView< MatrixType, UpLo >::RealScalar Eigen::SelfAdjointView< MatrixType, UpLo >::operatorNorm ( ) const
inline

Computes the L2 operator norm.

Returns
Operator norm of the matrix.

This is defined in the Eigenvalues module.

#include <Eigen/Eigenvalues>

This function computes the L2 operator norm of a self-adjoint matrix. For a self-adjoint matrix, the operator norm is the largest eigenvalue.

The current implementation uses the eigenvalues of the matrix, as computed by eigenvalues(), to compute the operator norm of the matrix.

Example:

// SPDX-FileCopyrightText: The Eigen Authors
// SPDX-License-Identifier: MPL-2.0
MatrixXd ones = MatrixXd::Ones(3, 3);
cout << "The operator norm of the 3x3 matrix of ones is " << ones.selfadjointView<Lower>().operatorNorm() << endl;
RealScalar operatorNorm() const
Computes the L2 operator norm.
Definition MatrixBaseEigenvalues.h:136

Output:

The operator norm of the 3x3 matrix of ones is 3
See also
eigenvalues(), MatrixBase::operatorNorm()

◆ rankUpdate() [1/2]

template<typename MatrixType_, unsigned int UpLo>
template<typename DerivedU, typename DerivedV>
SelfAdjointView & Eigen::SelfAdjointView< MatrixType_, UpLo >::rankUpdate ( const MatrixBase< DerivedU > & u,
const MatrixBase< DerivedV > & v,
const Scalar & alpha = Scalar(1) )

Perform a symmetric rank 2 update of the selfadjoint matrix *this: \( this = this + \alpha u v^* + conj(\alpha) v u^* \)

Returns
a reference to *this

The vectors u and v must be column vectors, however they can be an adjoint expression without any overhead. Only the meaningful triangular part of the matrix is updated, the rest is left unchanged.

See also
rankUpdate(const MatrixBase<DerivedU>&, Scalar)

◆ rankUpdate() [2/2]

template<typename MatrixType_, unsigned int UpLo>
template<typename DerivedU>
SelfAdjointView & Eigen::SelfAdjointView< MatrixType_, UpLo >::rankUpdate ( const MatrixBase< DerivedU > & u,
const Scalar & alpha = Scalar(1) )

Perform a symmetric rank K update of the selfadjoint matrix *this: \( this = this + \alpha ( u u^* ) \) where u is a vector or matrix.

Returns
a reference to *this

Note that to perform \( this = this + \alpha ( u^* u ) \) you can simply call this function with u.adjoint().

See also
rankUpdate(const MatrixBase<DerivedU>&, const MatrixBase<DerivedV>&, Scalar)

◆ triangularView()

template<typename MatrixType_, unsigned int UpLo>
template<unsigned int TriMode>
std::conditional_t<(TriMode &(Upper|Lower))==(UpLo &(Upper|Lower)), TriangularView< MatrixType, TriMode >, TriangularView< typename MatrixType::AdjointReturnType, TriMode > > Eigen::SelfAdjointView< MatrixType_, UpLo >::triangularView ( ) const
inline
Returns
an expression of a triangular view extracted from the current selfadjoint view of a given triangular part

The parameter TriMode can have the following values: Upper, StrictlyUpper, UnitUpper, Lower, StrictlyLower, UnitLower.

If TriMode references the same triangular part than *this, then this method simply return a TriangularView of the nested expression, otherwise, the nested expression is first transposed, thus returning a TriangularView<Transpose<MatrixType>> object.

See also
MatrixBase::triangularView(), class TriangularView

The documentation for this class was generated from the following files: