Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Eigen::FullPivHouseholderQR< _MatrixType > Class Template Reference

Householder rank-revealing QR decomposition of a matrix with full pivoting. More...

#include <src/eigen/Eigen/src/QR/FullPivHouseholderQR.h>

+ Inheritance diagram for Eigen::FullPivHouseholderQR< _MatrixType >:
+ Collaboration diagram for Eigen::FullPivHouseholderQR< _MatrixType >:

Public Types

enum  { RowsAtCompileTime = MatrixType::RowsAtCompileTime , ColsAtCompileTime = MatrixType::ColsAtCompileTime , MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime , MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }
 
typedef _MatrixType MatrixType
 
typedef MatrixType::Scalar Scalar
 
typedef MatrixType::RealScalar RealScalar
 
typedef MatrixType::StorageIndex StorageIndex
 
typedef internal::FullPivHouseholderQRMatrixQReturnType< MatrixTypeMatrixQReturnType
 
typedef internal::plain_diag_type< MatrixType >::type HCoeffsType
 
typedef Matrix< StorageIndex, 1, EIGEN_SIZE_MIN_PREFER_DYNAMIC(ColsAtCompileTime, RowsAtCompileTime), RowMajor, 1, EIGEN_SIZE_MIN_PREFER_FIXED(MaxColsAtCompileTime, MaxRowsAtCompileTime)> IntDiagSizeVectorType
 
typedef PermutationMatrix< ColsAtCompileTime, MaxColsAtCompileTimePermutationType
 
typedef internal::plain_row_type< MatrixType >::type RowVectorType
 
typedef internal::plain_col_type< MatrixType >::type ColVectorType
 
typedef MatrixType::PlainObject PlainObject
 

Public Member Functions

 FullPivHouseholderQR ()
 Default Constructor.
 
 FullPivHouseholderQR (Index rows, Index cols)
 Default Constructor with memory preallocation.
 
template<typename InputType >
 FullPivHouseholderQR (const EigenBase< InputType > &matrix)
 Constructs a QR factorization from a given matrix.
 
template<typename InputType >
 FullPivHouseholderQR (EigenBase< InputType > &matrix)
 Constructs a QR factorization from a given matrix.
 
template<typename Rhs >
const Solve< FullPivHouseholderQR, Rhs > solve (const MatrixBase< Rhs > &b) const
 
MatrixQReturnType matrixQ (void) const
 
const MatrixTypematrixQR () const
 
template<typename InputType >
FullPivHouseholderQRcompute (const EigenBase< InputType > &matrix)
 
const PermutationTypecolsPermutation () const
 
const IntDiagSizeVectorTyperowsTranspositions () const
 
MatrixType::RealScalar absDeterminant () const
 
MatrixType::RealScalar logAbsDeterminant () const
 
Index rank () const
 
Index dimensionOfKernel () const
 
bool isInjective () const
 
bool isSurjective () const
 
bool isInvertible () const
 
const Inverse< FullPivHouseholderQRinverse () const
 
Index rows () const
 
Index cols () const
 
const HCoeffsTypehCoeffs () const
 
FullPivHouseholderQRsetThreshold (const RealScalar &threshold)
 
FullPivHouseholderQRsetThreshold (Default_t)
 
RealScalar threshold () const
 
Index nonzeroPivots () const
 
RealScalar maxPivot () const
 
template<typename RhsType , typename DstType >
EIGEN_DEVICE_FUNC void _solve_impl (const RhsType &rhs, DstType &dst) const
 
template<typename InputType >
FullPivHouseholderQR< MatrixType > & compute (const EigenBase< InputType > &matrix)
 
template<typename RhsType , typename DstType >
void _solve_impl (const RhsType &rhs, DstType &dst) const
 

Protected Member Functions

void computeInPlace ()
 

Static Protected Member Functions

static void check_template_parameters ()
 

Protected Attributes

MatrixType m_qr
 
HCoeffsType m_hCoeffs
 
IntDiagSizeVectorType m_rows_transpositions
 
IntDiagSizeVectorType m_cols_transpositions
 
PermutationType m_cols_permutation
 
RowVectorType m_temp
 
bool m_isInitialized
 
bool m_usePrescribedThreshold
 
RealScalar m_prescribedThreshold
 
RealScalar m_maxpivot
 
Index m_nonzero_pivots
 
RealScalar m_precision
 
Index m_det_pq
 

Detailed Description

template<typename _MatrixType>
class Eigen::FullPivHouseholderQR< _MatrixType >

Householder rank-revealing QR decomposition of a matrix with full pivoting.

Template Parameters
_MatrixTypethe type of the matrix of which we are computing the QR decomposition

This class performs a rank-revealing QR decomposition of a matrix A into matrices P, P', Q and R such that

\[
 \mathbf{P} \, \mathbf{A} \, \mathbf{P}' = \mathbf{Q} \, \mathbf{R}
\]

by using Householder transformations. Here, P and P' are permutation matrices, Q a unitary matrix and R an upper triangular matrix.

This decomposition performs a very prudent full pivoting in order to be rank-revealing and achieve optimal numerical stability. The trade-off is that it is slower than HouseholderQR and ColPivHouseholderQR.

This class supports the inplace decomposition mechanism.

See also
MatrixBase::fullPivHouseholderQr()

Member Typedef Documentation

◆ ColVectorType

template<typename _MatrixType >
typedef internal::plain_col_type<MatrixType>::type Eigen::FullPivHouseholderQR< _MatrixType >::ColVectorType

◆ HCoeffsType

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

◆ IntDiagSizeVectorType

◆ MatrixQReturnType

template<typename _MatrixType >
typedef internal::FullPivHouseholderQRMatrixQReturnType<MatrixType> Eigen::FullPivHouseholderQR< _MatrixType >::MatrixQReturnType

◆ MatrixType

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

◆ PermutationType

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

◆ PlainObject

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

◆ RealScalar

template<typename _MatrixType >
typedef MatrixType::RealScalar Eigen::FullPivHouseholderQR< _MatrixType >::RealScalar

◆ RowVectorType

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

◆ Scalar

template<typename _MatrixType >
typedef MatrixType::Scalar Eigen::FullPivHouseholderQR< _MatrixType >::Scalar

◆ StorageIndex

template<typename _MatrixType >
typedef MatrixType::StorageIndex Eigen::FullPivHouseholderQR< _MatrixType >::StorageIndex

Member Enumeration Documentation

◆ anonymous enum

template<typename _MatrixType >
anonymous enum
Enumerator
RowsAtCompileTime 
ColsAtCompileTime 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 
62 {
63 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
64 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
65 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
66 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
67 };
@ MaxColsAtCompileTime
Definition FullPivHouseholderQR.h:66
@ MaxRowsAtCompileTime
Definition FullPivHouseholderQR.h:65
@ ColsAtCompileTime
Definition FullPivHouseholderQR.h:64
@ RowsAtCompileTime
Definition FullPivHouseholderQR.h:63

Constructor & Destructor Documentation

◆ FullPivHouseholderQR() [1/4]

template<typename _MatrixType >
Eigen::FullPivHouseholderQR< _MatrixType >::FullPivHouseholderQR ( )
inline

Default Constructor.

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

88 : m_qr(),
89 m_hCoeffs(),
93 m_temp(),
94 m_isInitialized(false),
PermutationType m_cols_permutation
Definition FullPivHouseholderQR.h:415
HCoeffsType m_hCoeffs
Definition FullPivHouseholderQR.h:412
bool m_isInitialized
Definition FullPivHouseholderQR.h:417
IntDiagSizeVectorType m_rows_transpositions
Definition FullPivHouseholderQR.h:413
MatrixType m_qr
Definition FullPivHouseholderQR.h:411
bool m_usePrescribedThreshold
Definition FullPivHouseholderQR.h:417
IntDiagSizeVectorType m_cols_transpositions
Definition FullPivHouseholderQR.h:414
RowVectorType m_temp
Definition FullPivHouseholderQR.h:416

◆ FullPivHouseholderQR() [2/4]

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

Default Constructor with memory preallocation.

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

See also
FullPivHouseholderQR()
104 : m_qr(rows, cols),
105 m_hCoeffs((std::min)(rows,cols)),
106 m_rows_transpositions((std::min)(rows,cols)),
107 m_cols_transpositions((std::min)(rows,cols)),
109 m_temp(cols),
110 m_isInitialized(false),
Index cols() const
Definition FullPivHouseholderQR.h:319
Index rows() const
Definition FullPivHouseholderQR.h:318

◆ FullPivHouseholderQR() [3/4]

template<typename _MatrixType >
template<typename InputType >
Eigen::FullPivHouseholderQR< _MatrixType >::FullPivHouseholderQR ( const EigenBase< InputType > &  matrix)
inlineexplicit

Constructs a QR factorization from a given matrix.

This constructor computes the QR factorization of the matrix matrix by calling the method compute(). It is a short cut for:

FullPivHouseholderQR<MatrixType> qr(matrix.rows(), matrix.cols());
qr.compute(matrix);
Householder rank-revealing QR decomposition of a matrix with full pivoting.
Definition FullPivHouseholderQR.h:58
See also
compute()
127 : m_qr(matrix.rows(), matrix.cols()),
128 m_hCoeffs((std::min)(matrix.rows(), matrix.cols())),
129 m_rows_transpositions((std::min)(matrix.rows(), matrix.cols())),
130 m_cols_transpositions((std::min)(matrix.rows(), matrix.cols())),
131 m_cols_permutation(matrix.cols()),
132 m_temp(matrix.cols()),
133 m_isInitialized(false),
135 {
136 compute(matrix.derived());
137 }
FullPivHouseholderQR & compute(const EigenBase< InputType > &matrix)

References Eigen::FullPivHouseholderQR< _MatrixType >::compute(), and Eigen::EigenBase< Derived >::derived().

+ Here is the call graph for this function:

◆ FullPivHouseholderQR() [4/4]

template<typename _MatrixType >
template<typename InputType >
Eigen::FullPivHouseholderQR< _MatrixType >::FullPivHouseholderQR ( EigenBase< InputType > &  matrix)
inlineexplicit

Constructs a QR factorization from a given matrix.

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

See also
FullPivHouseholderQR(const EigenBase&)
147 : m_qr(matrix.derived()),
148 m_hCoeffs((std::min)(matrix.rows(), matrix.cols())),
149 m_rows_transpositions((std::min)(matrix.rows(), matrix.cols())),
150 m_cols_transpositions((std::min)(matrix.rows(), matrix.cols())),
151 m_cols_permutation(matrix.cols()),
152 m_temp(matrix.cols()),
153 m_isInitialized(false),
155 {
157 }
void computeInPlace()
Definition FullPivHouseholderQR.h:457

References Eigen::FullPivHouseholderQR< _MatrixType >::computeInPlace().

+ Here is the call graph for this function:

Member Function Documentation

◆ _solve_impl() [1/2]

template<typename _MatrixType >
template<typename RhsType , typename DstType >
EIGEN_DEVICE_FUNC void Eigen::FullPivHouseholderQR< _MatrixType >::_solve_impl ( const RhsType &  rhs,
DstType &  dst 
) const

◆ _solve_impl() [2/2]

template<typename _MatrixType >
template<typename RhsType , typename DstType >
void Eigen::FullPivHouseholderQR< _MatrixType >::_solve_impl ( const RhsType &  rhs,
DstType &  dst 
) const
543{
544 eigen_assert(rhs.rows() == rows());
545 const Index l_rank = rank();
546
547 // FIXME introduce nonzeroPivots() and use it here. and more generally,
548 // make the same improvements in this dec as in FullPivLU.
549 if(l_rank==0)
550 {
551 dst.setZero();
552 return;
553 }
554
555 typename RhsType::PlainObject c(rhs);
556
557 Matrix<Scalar,1,RhsType::ColsAtCompileTime> temp(rhs.cols());
558 for (Index k = 0; k < l_rank; ++k)
559 {
560 Index remainingSize = rows()-k;
561 c.row(k).swap(c.row(m_rows_transpositions.coeff(k)));
562 c.bottomRightCorner(remainingSize, rhs.cols())
563 .applyHouseholderOnTheLeft(m_qr.col(k).tail(remainingSize-1),
564 m_hCoeffs.coeff(k), &temp.coeffRef(0));
565 }
566
567 m_qr.topLeftCorner(l_rank, l_rank)
568 .template triangularView<Upper>()
569 .solveInPlace(c.topRows(l_rank));
570
571 for(Index i = 0; i < l_rank; ++i) dst.row(m_cols_permutation.indices().coeff(i)) = c.row(i);
572 for(Index i = l_rank; i < cols(); ++i) dst.row(m_cols_permutation.indices().coeff(i)).setZero();
573}
#define eigen_assert(x)
Definition Macros.h:579
Index rank() const
Definition FullPivHouseholderQR.h:246
const IndicesType & indices() const
Definition PermutationMatrix.h:388
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Definition PlainObjectBase.h:160
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:33

References Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >::coeffRef(), and eigen_assert.

+ Here is the call graph for this function:

◆ absDeterminant()

template<typename MatrixType >
MatrixType::RealScalar Eigen::FullPivHouseholderQR< MatrixType >::absDeterminant
Returns
the absolute value of the determinant of the matrix of which *this is the QR decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the QR decomposition has already been computed.
Note
This is only for square matrices.
Warning
a determinant can be very big or small, so for matrices of large enough dimension, there is a risk of overflow/underflow. One way to work around that is to use logAbsDeterminant() instead.
See also
logAbsDeterminant(), MatrixBase::determinant()
426{
427 using std::abs;
428 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
429 eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
430 return abs(m_qr.diagonal().prod());
431}
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half abs(const half &a)
Definition Half.h:445

References eigen_assert.

◆ check_template_parameters()

template<typename _MatrixType >
static void Eigen::FullPivHouseholderQR< _MatrixType >::check_template_parameters ( )
inlinestaticprotected
405 {
407 }
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
Definition StaticAssert.h:184
MatrixType::Scalar Scalar
Definition FullPivHouseholderQR.h:68

References EIGEN_STATIC_ASSERT_NON_INTEGER.

◆ cols()

template<typename _MatrixType >
Index Eigen::FullPivHouseholderQR< _MatrixType >::cols ( ) const
inline
319{ return m_qr.cols(); }

References Eigen::FullPivHouseholderQR< _MatrixType >::m_qr.

Referenced by Eigen::FullPivHouseholderQR< _MatrixType >::dimensionOfKernel(), and Eigen::FullPivHouseholderQR< _MatrixType >::isInjective().

+ Here is the caller graph for this function:

◆ colsPermutation()

template<typename _MatrixType >
const PermutationType & Eigen::FullPivHouseholderQR< _MatrixType >::colsPermutation ( ) const
inline
Returns
a const reference to the column permutation matrix
199 {
200 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
201 return m_cols_permutation;
202 }

References eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::m_cols_permutation, and Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized.

◆ compute() [1/2]

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

Referenced by Eigen::FullPivHouseholderQR< _MatrixType >::FullPivHouseholderQR().

+ Here is the caller graph for this function:

◆ compute() [2/2]

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

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

See also
class FullPivHouseholderQR, FullPivHouseholderQR(const MatrixType&)
450{
451 m_qr = matrix.derived();
453 return *this;
454}

References Eigen::EigenBase< Derived >::derived().

+ Here is the call graph for this function:

◆ computeInPlace()

template<typename MatrixType >
void Eigen::FullPivHouseholderQR< MatrixType >::computeInPlace
protected
458{
460
461 using std::abs;
462 Index rows = m_qr.rows();
463 Index cols = m_qr.cols();
464 Index size = (std::min)(rows,cols);
465
466
467 m_hCoeffs.resize(size);
468
469 m_temp.resize(cols);
470
471 m_precision = NumTraits<Scalar>::epsilon() * RealScalar(size);
472
475 Index number_of_transpositions = 0;
476
477 RealScalar biggest(0);
478
479 m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case)
481
482 for (Index k = 0; k < size; ++k)
483 {
484 Index row_of_biggest_in_corner, col_of_biggest_in_corner;
485 typedef internal::scalar_score_coeff_op<Scalar> Scoring;
486 typedef typename Scoring::result_type Score;
487
488 Score score = m_qr.bottomRightCorner(rows-k, cols-k)
489 .unaryExpr(Scoring())
490 .maxCoeff(&row_of_biggest_in_corner, &col_of_biggest_in_corner);
491 row_of_biggest_in_corner += k;
492 col_of_biggest_in_corner += k;
493 RealScalar biggest_in_corner = internal::abs_knowing_score<Scalar>()(m_qr(row_of_biggest_in_corner, col_of_biggest_in_corner), score);
494 if(k==0) biggest = biggest_in_corner;
495
496 // if the corner is negligible, then we have less than full rank, and we can finish early
497 if(internal::isMuchSmallerThan(biggest_in_corner, biggest, m_precision))
498 {
500 for(Index i = k; i < size; i++)
501 {
504 m_hCoeffs.coeffRef(i) = Scalar(0);
505 }
506 break;
507 }
508
509 m_rows_transpositions.coeffRef(k) = row_of_biggest_in_corner;
510 m_cols_transpositions.coeffRef(k) = col_of_biggest_in_corner;
511 if(k != row_of_biggest_in_corner) {
512 m_qr.row(k).tail(cols-k).swap(m_qr.row(row_of_biggest_in_corner).tail(cols-k));
513 ++number_of_transpositions;
514 }
515 if(k != col_of_biggest_in_corner) {
516 m_qr.col(k).swap(m_qr.col(col_of_biggest_in_corner));
517 ++number_of_transpositions;
518 }
519
520 RealScalar beta;
521 m_qr.col(k).tail(rows-k).makeHouseholderInPlace(m_hCoeffs.coeffRef(k), beta);
522 m_qr.coeffRef(k,k) = beta;
523
524 // remember the maximum absolute value of diagonal coefficients
525 if(abs(beta) > m_maxpivot) m_maxpivot = abs(beta);
526
527 m_qr.bottomRightCorner(rows-k, cols-k-1)
528 .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows-k-1), m_hCoeffs.coeffRef(k), &m_temp.coeffRef(k+1));
529 }
530
532 for(Index k = 0; k < size; ++k)
534
535 m_det_pq = (number_of_transpositions%2) ? -1 : 1;
536 m_isInitialized = true;
537}
MatrixType::RealScalar RealScalar
Definition FullPivHouseholderQR.h:69
RealScalar m_maxpivot
Definition FullPivHouseholderQR.h:418
RealScalar m_precision
Definition FullPivHouseholderQR.h:420
Index m_det_pq
Definition FullPivHouseholderQR.h:421
static void check_template_parameters()
Definition FullPivHouseholderQR.h:404
Index m_nonzero_pivots
Definition FullPivHouseholderQR.h:419
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Definition PlainObjectBase.h:183
Derived & applyTranspositionOnTheRight(Index i, Index j)
Definition PermutationMatrix.h:185
void setIdentity()
Definition PermutationMatrix.h:142
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Definition PlainObjectBase.h:279
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition MathFunctions.h:1354
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References Eigen::internal::isMuchSmallerThan().

Referenced by Eigen::FullPivHouseholderQR< _MatrixType >::FullPivHouseholderQR().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dimensionOfKernel()

template<typename _MatrixType >
Index Eigen::FullPivHouseholderQR< _MatrixType >::dimensionOfKernel ( ) const
inline
Returns
the dimension of the kernel of the matrix of which *this is the QR decomposition.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).
264 {
265 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
266 return cols() - rank();
267 }

References Eigen::FullPivHouseholderQR< _MatrixType >::cols(), eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized, and Eigen::FullPivHouseholderQR< _MatrixType >::rank().

+ Here is the call graph for this function:

◆ hCoeffs()

template<typename _MatrixType >
const HCoeffsType & Eigen::FullPivHouseholderQR< _MatrixType >::hCoeffs ( ) const
inline
Returns
a const reference to the vector of Householder coefficients used to represent the factor Q.

For advanced uses only.

325{ return m_hCoeffs; }

References Eigen::FullPivHouseholderQR< _MatrixType >::m_hCoeffs.

◆ inverse()

template<typename _MatrixType >
const Inverse< FullPivHouseholderQR > Eigen::FullPivHouseholderQR< _MatrixType >::inverse ( ) const
inline
Returns
the inverse of the matrix of which *this is the QR decomposition.
Note
If this matrix is not invertible, the returned matrix has undefined coefficients. Use isInvertible() to first determine whether this matrix is invertible.
313 {
314 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
315 return Inverse<FullPivHouseholderQR>(*this);
316 }

References eigen_assert, and Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized.

◆ isInjective()

template<typename _MatrixType >
bool Eigen::FullPivHouseholderQR< _MatrixType >::isInjective ( ) const
inline
Returns
true if the matrix of which *this is the QR decomposition represents an injective linear map, i.e. has trivial kernel; false otherwise.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).
277 {
278 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
279 return rank() == cols();
280 }

References Eigen::FullPivHouseholderQR< _MatrixType >::cols(), eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized, and Eigen::FullPivHouseholderQR< _MatrixType >::rank().

Referenced by Eigen::FullPivHouseholderQR< _MatrixType >::isInvertible().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isInvertible()

template<typename _MatrixType >
bool Eigen::FullPivHouseholderQR< _MatrixType >::isInvertible ( ) const
inline
Returns
true if the matrix of which *this is the QR decomposition is invertible.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).
302 {
303 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
304 return isInjective() && isSurjective();
305 }
bool isInjective() const
Definition FullPivHouseholderQR.h:276
bool isSurjective() const
Definition FullPivHouseholderQR.h:289

References eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::isInjective(), Eigen::FullPivHouseholderQR< _MatrixType >::isSurjective(), and Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized.

+ Here is the call graph for this function:

◆ isSurjective()

template<typename _MatrixType >
bool Eigen::FullPivHouseholderQR< _MatrixType >::isSurjective ( ) const
inline
Returns
true if the matrix of which *this is the QR decomposition represents a surjective linear map; false otherwise.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).
290 {
291 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
292 return rank() == rows();
293 }

References eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized, Eigen::FullPivHouseholderQR< _MatrixType >::rank(), and Eigen::FullPivHouseholderQR< _MatrixType >::rows().

Referenced by Eigen::FullPivHouseholderQR< _MatrixType >::isInvertible().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logAbsDeterminant()

template<typename MatrixType >
MatrixType::RealScalar Eigen::FullPivHouseholderQR< MatrixType >::logAbsDeterminant
Returns
the natural log of the absolute value of the determinant of the matrix of which *this is the QR decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the QR decomposition has already been computed.
Note
This is only for square matrices.
This method is useful to work around the risk of overflow/underflow that's inherent to determinant computation.
See also
absDeterminant(), MatrixBase::determinant()
435{
436 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
437 eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
438 return m_qr.diagonal().cwiseAbs().array().log().sum();
439}

References eigen_assert.

◆ matrixQ()

Returns
Expression object representing the matrix Q
658{
659 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
661}
internal::FullPivHouseholderQRMatrixQReturnType< MatrixType > MatrixQReturnType
Definition FullPivHouseholderQR.h:72

References eigen_assert.

◆ matrixQR()

template<typename _MatrixType >
const MatrixType & Eigen::FullPivHouseholderQR< _MatrixType >::matrixQR ( ) const
inline
Returns
a reference to the matrix where the Householder QR decomposition is stored
189 {
190 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
191 return m_qr;
192 }

References eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized, and Eigen::FullPivHouseholderQR< _MatrixType >::m_qr.

◆ maxPivot()

template<typename _MatrixType >
RealScalar Eigen::FullPivHouseholderQR< _MatrixType >::maxPivot ( ) const
inline
Returns
the absolute value of the biggest pivot, i.e. the biggest diagonal coefficient of U.
394{ return m_maxpivot; }

References Eigen::FullPivHouseholderQR< _MatrixType >::m_maxpivot.

◆ nonzeroPivots()

template<typename _MatrixType >
Index Eigen::FullPivHouseholderQR< _MatrixType >::nonzeroPivots ( ) const
inline
Returns
the number of nonzero pivots in the QR 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.
See also
rank()
386 {
387 eigen_assert(m_isInitialized && "LU is not initialized.");
388 return m_nonzero_pivots;
389 }

References eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized, and Eigen::FullPivHouseholderQR< _MatrixType >::m_nonzero_pivots.

◆ rank()

template<typename _MatrixType >
Index Eigen::FullPivHouseholderQR< _MatrixType >::rank ( ) const
inline
Returns
the rank of the matrix of which *this is the QR decomposition.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).
247 {
248 using std::abs;
249 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
250 RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold();
251 Index result = 0;
252 for(Index i = 0; i < m_nonzero_pivots; ++i)
253 result += (abs(m_qr.coeff(i,i)) > premultiplied_threshold);
254 return result;
255 }
RealScalar threshold() const
Definition FullPivHouseholderQR.h:369

References eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized, Eigen::FullPivHouseholderQR< _MatrixType >::m_maxpivot, Eigen::FullPivHouseholderQR< _MatrixType >::m_nonzero_pivots, Eigen::FullPivHouseholderQR< _MatrixType >::m_qr, and Eigen::FullPivHouseholderQR< _MatrixType >::threshold().

Referenced by Eigen::FullPivHouseholderQR< _MatrixType >::dimensionOfKernel(), Eigen::FullPivHouseholderQR< _MatrixType >::isInjective(), and Eigen::FullPivHouseholderQR< _MatrixType >::isSurjective().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rows()

template<typename _MatrixType >
Index Eigen::FullPivHouseholderQR< _MatrixType >::rows ( ) const
inline
318{ return m_qr.rows(); }

References Eigen::FullPivHouseholderQR< _MatrixType >::m_qr.

Referenced by Eigen::FullPivHouseholderQR< _MatrixType >::isSurjective().

+ Here is the caller graph for this function:

◆ rowsTranspositions()

template<typename _MatrixType >
const IntDiagSizeVectorType & Eigen::FullPivHouseholderQR< _MatrixType >::rowsTranspositions ( ) const
inline
Returns
a const reference to the vector of indices representing the rows transpositions
206 {
207 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
209 }

References eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized, and Eigen::FullPivHouseholderQR< _MatrixType >::m_rows_transpositions.

◆ setThreshold() [1/2]

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

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. This is not used for the QR decomposition itself.

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.

Parameters
thresholdThe new value to use as the threshold.

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)

345 {
348 return *this;
349 }
RealScalar m_prescribedThreshold
Definition FullPivHouseholderQR.h:418

References Eigen::FullPivHouseholderQR< _MatrixType >::m_prescribedThreshold, Eigen::FullPivHouseholderQR< _MatrixType >::m_usePrescribedThreshold, and Eigen::FullPivHouseholderQR< _MatrixType >::threshold().

+ Here is the call graph for this function:

◆ setThreshold() [2/2]

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

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);
@ Default
Definition Constants.h:352

See the documentation of setThreshold(const RealScalar&).

360 {
362 return *this;
363 }

References Eigen::FullPivHouseholderQR< _MatrixType >::m_usePrescribedThreshold.

◆ solve()

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

This method finds a solution x to the equation Ax=b, where A is the matrix of which *this is the QR decomposition.

Parameters
bthe right-hand-side of the equation to solve.
Returns
the exact or least-square solution if the rank is greater or equal to the number of columns of A, and an arbitrary solution otherwise.

\note_about_checking_solutions

\note_about_arbitrary_choice_of_solution

Example:

Output:

 
177 {
178 eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
179 return Solve<FullPivHouseholderQR, Rhs>(*this, b.derived());
180 }

References eigen_assert, and Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized.

◆ threshold()

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

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

See the documentation of setThreshold(const RealScalar&).

370 {
373 // this formula comes from experimenting (see "LU precision tuning" thread on the list)
374 // and turns out to be identical to Higham's formula used already in LDLt.
375 : NumTraits<Scalar>::epsilon() * RealScalar(m_qr.diagonalSize());
376 }

References eigen_assert, Eigen::FullPivHouseholderQR< _MatrixType >::m_isInitialized, Eigen::FullPivHouseholderQR< _MatrixType >::m_prescribedThreshold, Eigen::FullPivHouseholderQR< _MatrixType >::m_qr, and Eigen::FullPivHouseholderQR< _MatrixType >::m_usePrescribedThreshold.

Referenced by Eigen::FullPivHouseholderQR< _MatrixType >::rank(), and Eigen::FullPivHouseholderQR< _MatrixType >::setThreshold().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_cols_permutation

template<typename _MatrixType >
PermutationType Eigen::FullPivHouseholderQR< _MatrixType >::m_cols_permutation
protected

◆ m_cols_transpositions

template<typename _MatrixType >
IntDiagSizeVectorType Eigen::FullPivHouseholderQR< _MatrixType >::m_cols_transpositions
protected

◆ m_det_pq

template<typename _MatrixType >
Index Eigen::FullPivHouseholderQR< _MatrixType >::m_det_pq
protected

◆ m_hCoeffs

template<typename _MatrixType >
HCoeffsType Eigen::FullPivHouseholderQR< _MatrixType >::m_hCoeffs
protected

◆ m_isInitialized

◆ m_maxpivot

template<typename _MatrixType >
RealScalar Eigen::FullPivHouseholderQR< _MatrixType >::m_maxpivot
protected

◆ m_nonzero_pivots

template<typename _MatrixType >
Index Eigen::FullPivHouseholderQR< _MatrixType >::m_nonzero_pivots
protected

◆ m_precision

template<typename _MatrixType >
RealScalar Eigen::FullPivHouseholderQR< _MatrixType >::m_precision
protected

◆ m_prescribedThreshold

template<typename _MatrixType >
RealScalar Eigen::FullPivHouseholderQR< _MatrixType >::m_prescribedThreshold
protected

◆ m_qr

◆ m_rows_transpositions

template<typename _MatrixType >
IntDiagSizeVectorType Eigen::FullPivHouseholderQR< _MatrixType >::m_rows_transpositions
protected

◆ m_temp

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

◆ m_usePrescribedThreshold


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