template<typename _MatrixType>
Eigen::CompleteOrthogonalDecomposition class

Complete orthogonal decomposition (COD) of a matrix.

This class performs a rank-revealing complete orthogonal decomposition of a matrix A into matrices P, Q, T, and Z such that

\[ \mathbf{A} \, \mathbf{P} = \mathbf{Q} \, \begin{bmatrix} \mathbf{T} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} \end{bmatrix} \, \mathbf{Z} \]

by using Householder transformations. Here, P is a permutation matrix, Q and Z are unitary matrices and T an upper triangular matrix of size rank-by-rank. A may be rank deficient.

This class supports the inplace decomposition mechanism.

Base classes

template<typename Derived>
class SolverBase
A base class for matrix decomposition and solvers.

Public types

enum (anonymous) { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }
using Base = SolverBase<CompleteOrthogonalDecomposition>
using HCoeffsType = internal::plain_diag_type<MatrixType>::type
using HouseholderSequenceType = HouseholderSequence<MatrixType, typename internal::remove_all<typename HCoeffsType::ConjugateReturnType>::type>
using IntRowVectorType = internal::plain_row_type<MatrixType, Index>::type
using MatrixType = _MatrixType
using PermutationType = PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime>
using PlainObject = MatrixType::PlainObject
using RealRowVectorType = internal::plain_row_type<MatrixType, RealScalar>::type
using RowVectorType = internal::plain_row_type<MatrixType>::type

Constructors, destructors, conversion operators

CompleteOrthogonalDecomposition()
Default Constructor.
CompleteOrthogonalDecomposition(Index rows, Index cols)
Default Constructor with memory preallocation.
template<typename InputType>
CompleteOrthogonalDecomposition(const EigenBase<InputType>& matrix) explicit
Constructs a complete orthogonal decomposition from a given matrix.
template<typename InputType>
CompleteOrthogonalDecomposition(EigenBase<InputType>& matrix) explicit
Constructs a complete orthogonal decomposition from a given matrix.

Public functions

auto absDeterminant() const -> MatrixType::RealScalar
auto cols() const -> Index
auto colsPermutation() const -> const PermutationType&
template<typename InputType>
auto compute(const EigenBase<InputType>& matrix) -> CompleteOrthogonalDecomposition&
auto dimensionOfKernel() const -> Index
auto hCoeffs() const -> const HCoeffsType&
auto householderQ(void) const -> HouseholderSequenceType
auto info() const -> ComputationInfo
Reports whether the complete orthogonal decomposition was successful.
auto isInjective() const -> bool
auto isInvertible() const -> bool
auto isSurjective() const -> bool
auto logAbsDeterminant() const -> MatrixType::RealScalar
auto matrixQ(void) const -> HouseholderSequenceType
auto matrixQTZ() const -> const MatrixType&
auto matrixT() const -> const MatrixType&
auto matrixZ() const -> MatrixType
auto maxPivot() const -> RealScalar
auto nonzeroPivots() const -> Index
auto pseudoInverse() const -> const Inverse<CompleteOrthogonalDecomposition>
auto rank() const -> Index
auto rows() const -> Index
auto setThreshold(const RealScalar& threshold) -> CompleteOrthogonalDecomposition&
auto setThreshold(Default_t) -> CompleteOrthogonalDecomposition&
template<typename Rhs>
auto solve(const MatrixBase<Rhs>& b) const -> const Solve<CompleteOrthogonalDecomposition, Rhs>
auto threshold() const -> RealScalar
auto zCoeffs() const -> const HCoeffsType&

Protected static functions

static void check_template_parameters()

Protected functions

template<bool Transpose_, typename Rhs>
void _check_solve_assertion(const Rhs& b) const
template<typename Rhs>
void applyZAdjointOnTheLeftInPlace(Rhs& rhs) const
template<bool Conjugate, typename Rhs>
void applyZOnTheLeftInPlace(Rhs& rhs) const
void computeInPlace()

Protected variables

ColPivHouseholderQR<MatrixType> m_cpqr
RowVectorType m_temp
HCoeffsType m_zCoeffs

Enum documentation

template<typename _MatrixType>
enum Eigen::CompleteOrthogonalDecomposition<_MatrixType>::(anonymous)

Enumerators
MaxRowsAtCompileTime
MaxColsAtCompileTime

Typedef documentation

template<typename _MatrixType>
typedef SolverBase<CompleteOrthogonalDecomposition> Eigen::CompleteOrthogonalDecomposition<_MatrixType>::Base

template<typename _MatrixType>
typedef internal::plain_diag_type<MatrixType>::type Eigen::CompleteOrthogonalDecomposition<_MatrixType>::HCoeffsType

template<typename _MatrixType>
typedef HouseholderSequence<MatrixType, typename internal::remove_all<typename HCoeffsType::ConjugateReturnType>::type> Eigen::CompleteOrthogonalDecomposition<_MatrixType>::HouseholderSequenceType

template<typename _MatrixType>
typedef internal::plain_row_type<MatrixType, Index>::type Eigen::CompleteOrthogonalDecomposition<_MatrixType>::IntRowVectorType

template<typename _MatrixType>
typedef _MatrixType Eigen::CompleteOrthogonalDecomposition<_MatrixType>::MatrixType

template<typename _MatrixType>
typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> Eigen::CompleteOrthogonalDecomposition<_MatrixType>::PermutationType

template<typename _MatrixType>
typedef MatrixType::PlainObject Eigen::CompleteOrthogonalDecomposition<_MatrixType>::PlainObject

template<typename _MatrixType>
typedef internal::plain_row_type<MatrixType, RealScalar>::type Eigen::CompleteOrthogonalDecomposition<_MatrixType>::RealRowVectorType

template<typename _MatrixType>
typedef internal::plain_row_type<MatrixType>::type Eigen::CompleteOrthogonalDecomposition<_MatrixType>::RowVectorType

Function documentation

template<typename _MatrixType>
Eigen::CompleteOrthogonalDecomposition<_MatrixType>::CompleteOrthogonalDecomposition()

Default Constructor.

The default constructor is useful in cases in which the user intends to perform decompositions via CompleteOrthogonalDecomposition::compute(const* MatrixType&).

template<typename _MatrixType>
Eigen::CompleteOrthogonalDecomposition<_MatrixType>::CompleteOrthogonalDecomposition(Index rows, Index cols)

Default Constructor with memory preallocation.

Like the default constructor but with preallocation of the internal data according to the specified problem size.

template<typename _MatrixType> template<typename InputType>
Eigen::CompleteOrthogonalDecomposition<_MatrixType>::CompleteOrthogonalDecomposition(const EigenBase<InputType>& matrix) explicit

Constructs a complete orthogonal decomposition from a given matrix.

This constructor computes the complete orthogonal decomposition of the matrix matrix by calling the method compute(). The default threshold for rank determination will be used. It is a short cut for:

CompleteOrthogonalDecomposition<MatrixType> cod(matrix.rows(),
                                                matrix.cols());
cod.setThreshold(Default);
cod.compute(matrix);

template<typename _MatrixType> template<typename InputType>
Eigen::CompleteOrthogonalDecomposition<_MatrixType>::CompleteOrthogonalDecomposition(EigenBase<InputType>& matrix) explicit

Constructs a complete orthogonal decomposition from a given matrix.

This overloaded constructor is provided for inplace decomposition when MatrixType is a Eigen::Ref.

template<typename _MatrixType>
MatrixType::RealScalar Eigen::CompleteOrthogonalDecomposition<_MatrixType>::absDeterminant() const

Returns the absolute value of the determinant of the matrix of which *this is the complete orthogonal decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the complete orthogonal decomposition has already been computed.

template<typename _MatrixType>
Index Eigen::CompleteOrthogonalDecomposition<_MatrixType>::cols() const

template<typename _MatrixType>
const PermutationType& Eigen::CompleteOrthogonalDecomposition<_MatrixType>::colsPermutation() const

Returns a const reference to the column permutation matrix

template<typename _MatrixType> template<typename InputType>
CompleteOrthogonalDecomposition& Eigen::CompleteOrthogonalDecomposition<_MatrixType>::compute(const EigenBase<InputType>& matrix)

template<typename _MatrixType>
Index Eigen::CompleteOrthogonalDecomposition<_MatrixType>::dimensionOfKernel() const

Returns the dimension of the kernel of the matrix of which *this is the complete orthogonal decomposition.

template<typename _MatrixType>
const HCoeffsType& Eigen::CompleteOrthogonalDecomposition<_MatrixType>::hCoeffs() const

Returns a const reference to the vector of Householder coefficients used to represent the factor Q.

For advanced uses only.

template<typename _MatrixType>
HouseholderSequenceType Eigen::CompleteOrthogonalDecomposition<_MatrixType>::householderQ(void) const

Returns the matrix Q as a sequence of householder transformations

template<typename _MatrixType>
ComputationInfo Eigen::CompleteOrthogonalDecomposition<_MatrixType>::info() const

Reports whether the complete orthogonal decomposition was successful.

Returns Success

template<typename _MatrixType>
bool Eigen::CompleteOrthogonalDecomposition<_MatrixType>::isInjective() const

Returns true if the matrix of which *this is the decomposition represents an injective linear map, i.e. has trivial kernel; false otherwise.

template<typename _MatrixType>
bool Eigen::CompleteOrthogonalDecomposition<_MatrixType>::isInvertible() const

Returns true if the matrix of which *this is the complete orthogonal decomposition is invertible.

template<typename _MatrixType>
bool Eigen::CompleteOrthogonalDecomposition<_MatrixType>::isSurjective() const

Returns true if the matrix of which *this is the decomposition represents a surjective linear map; false otherwise.

template<typename _MatrixType>
MatrixType::RealScalar Eigen::CompleteOrthogonalDecomposition<_MatrixType>::logAbsDeterminant() const

Returns the natural log of the absolute value of the determinant of the matrix of which *this is the complete orthogonal decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the complete orthogonal decomposition has already been computed.

template<typename _MatrixType>
HouseholderSequenceType Eigen::CompleteOrthogonalDecomposition<_MatrixType>::matrixQ(void) const

template<typename _MatrixType>
const MatrixType& Eigen::CompleteOrthogonalDecomposition<_MatrixType>::matrixQTZ() const

Returns a reference to the matrix where the complete orthogonal decomposition is stored

template<typename _MatrixType>
const MatrixType& Eigen::CompleteOrthogonalDecomposition<_MatrixType>::matrixT() const

Returns a reference to the matrix where the complete orthogonal decomposition is stored.

template<typename _MatrixType>
MatrixType Eigen::CompleteOrthogonalDecomposition<_MatrixType>::matrixZ() const

Returns the matrix Z.

template<typename _MatrixType>
RealScalar Eigen::CompleteOrthogonalDecomposition<_MatrixType>::maxPivot() const

Returns the absolute value of the biggest pivot, i.e. the biggest diagonal coefficient of R.

template<typename _MatrixType>
Index Eigen::CompleteOrthogonalDecomposition<_MatrixType>::nonzeroPivots() const

Returns the number of nonzero pivots in the complete orthogonal decomposition. Here nonzero is meant in the exact sense, not in a fuzzy sense. So that notion isn't really intrinsically interesting, but it is still useful when implementing algorithms.

template<typename _MatrixType>
const Inverse<CompleteOrthogonalDecomposition> Eigen::CompleteOrthogonalDecomposition<_MatrixType>::pseudoInverse() const

Returns the pseudo-inverse of the matrix of which *this is the complete orthogonal decomposition.

template<typename _MatrixType>
Index Eigen::CompleteOrthogonalDecomposition<_MatrixType>::rank() const

Returns the rank of the matrix of which *this is the complete orthogonal decomposition.

template<typename _MatrixType>
Index Eigen::CompleteOrthogonalDecomposition<_MatrixType>::rows() const

template<typename _MatrixType>
CompleteOrthogonalDecomposition& Eigen::CompleteOrthogonalDecomposition<_MatrixType>::setThreshold(const RealScalar& threshold)

Parameters
threshold The new value to use as the threshold.

Allows to prescribe a threshold to be used by certain methods, such as rank(), who need to determine when pivots are to be considered nonzero. Most be called before calling compute().

When it needs to get the threshold value, Eigen calls threshold(). By default, this uses a formula to automatically determine a reasonable threshold. Once you have called the present method setThreshold(const RealScalar&), your value is used instead.

A pivot will be considered nonzero if its absolute value is strictly greater than $ \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert $ where maxpivot is the biggest pivot.

If you want to come back to the default behavior, call setThreshold(Default_t)

template<typename _MatrixType>
CompleteOrthogonalDecomposition& Eigen::CompleteOrthogonalDecomposition<_MatrixType>::setThreshold(Default_t)

Allows to come back to the default behavior, letting Eigen use its default formula for determining the threshold.

You should pass the special object Eigen::Default as parameter here. qr.setThreshold(Eigen::Default);

See the documentation of setThreshold(const RealScalar&).

template<typename _MatrixType> template<typename Rhs>
const Solve<CompleteOrthogonalDecomposition, Rhs> Eigen::CompleteOrthogonalDecomposition<_MatrixType>::solve(const MatrixBase<Rhs>& b) const

Parameters
b the right-hand sides of the problem to solve.
Returns a solution.

This method computes the minimum-norm solution X to a least squares problem

\[\mathrm{minimize} \|A X - B\|, \]

where A is the matrix of which *this is the complete orthogonal decomposition.

template<typename _MatrixType>
RealScalar Eigen::CompleteOrthogonalDecomposition<_MatrixType>::threshold() const

Returns the threshold that will be used by certain methods such as rank().

See the documentation of setThreshold(const RealScalar&).

template<typename _MatrixType>
const HCoeffsType& Eigen::CompleteOrthogonalDecomposition<_MatrixType>::zCoeffs() const

Returns a const reference to the vector of Householder coefficients used to represent the factor Z.

For advanced uses only.

template<typename _MatrixType>
static void Eigen::CompleteOrthogonalDecomposition<_MatrixType>::check_template_parameters() protected

template<typename _MatrixType> template<bool Transpose_, typename Rhs>
void Eigen::CompleteOrthogonalDecomposition<_MatrixType>::_check_solve_assertion(const Rhs& b) const protected

template<typename _MatrixType> template<typename Rhs>
void Eigen::CompleteOrthogonalDecomposition<_MatrixType>::applyZAdjointOnTheLeftInPlace(Rhs& rhs) const protected

Overwrites rhs with $ \mathbf{Z}^* * \mathbf{rhs} $ .

template<typename _MatrixType> template<bool Conjugate, typename Rhs>
void Eigen::CompleteOrthogonalDecomposition<_MatrixType>::applyZOnTheLeftInPlace(Rhs& rhs) const protected

Overwrites rhs with $ \mathbf{Z} * \mathbf{rhs} $ or $ \mathbf{\overline Z} * \mathbf{rhs} $ if Conjugate is set to true.

template<typename _MatrixType>
void Eigen::CompleteOrthogonalDecomposition<_MatrixType>::computeInPlace() protected

Performs the complete orthogonal decomposition of the given matrix matrix. The result of the factorization is stored into *this, and a reference to *this is returned.

Variable documentation

template<typename _MatrixType>
ColPivHouseholderQR<MatrixType> Eigen::CompleteOrthogonalDecomposition<_MatrixType>::m_cpqr protected

template<typename _MatrixType>
RowVectorType Eigen::CompleteOrthogonalDecomposition<_MatrixType>::m_temp protected

template<typename _MatrixType>
HCoeffsType Eigen::CompleteOrthogonalDecomposition<_MatrixType>::m_zCoeffs protected