11 #ifndef EIGEN_COLPIVOTINGHOUSEHOLDERQR_H
12 #define EIGEN_COLPIVOTINGHOUSEHOLDERQR_H
20 template <
typename MatrixType_,
typename PermutationIndex_>
53 template <
typename MatrixType_,
typename PermutationIndex_>
126 template <
typename InputType>
139 template <
typename InputType>
145 #ifdef EIGEN_PARSED_BY_DOXYGEN
160 template <
typename Rhs>
188 template <
typename InputType>
411 #ifndef EIGEN_PARSED_BY_DOXYGEN
412 template <
typename RhsType,
typename DstType>
415 template <
bool Conjugate,
typename RhsType,
typename DstType>
442 eigen_assert(
m_qr.rows() ==
m_qr.cols() &&
"You can't take the determinant of a non-square matrix!");
448 template <
typename MatrixType,
typename PermutationIndex>
452 eigen_assert(
m_qr.rows() ==
m_qr.cols() &&
"You can't take the determinant of a non-square matrix!");
456 template <
typename MatrixType,
typename PermutationIndex>
459 eigen_assert(
m_qr.rows() ==
m_qr.cols() &&
"You can't take the determinant of a non-square matrix!");
463 template <
typename MatrixType,
typename PermutationIndex>
466 eigen_assert(
m_qr.rows() ==
m_qr.cols() &&
"You can't take the determinant of a non-square matrix!");
478 template <
typename MatrixType,
typename PermutationIndex>
479 template <
typename InputType>
487 template <
typename MatrixType,
typename PermutationIndex>
502 Index number_of_transpositions = 0;
522 Index biggest_col_index;
524 biggest_col_index +=
k;
532 if (
k != biggest_col_index) {
533 m_qr.col(
k).swap(
m_qr.col(biggest_col_index));
536 ++number_of_transpositions;
565 if (temp2 <= norm_downdate_threshold) {
581 m_det_p = (number_of_transpositions % 2) ? -1 : 1;
585 #ifndef EIGEN_PARSED_BY_DOXYGEN
586 template <
typename MatrixType_,
typename PermutationIndex_>
587 template <
typename RhsType,
typename DstType>
591 if (nonzero_pivots == 0) {
596 typename RhsType::PlainObject
c(rhs);
600 m_qr.topLeftCorner(nonzero_pivots, nonzero_pivots)
601 .template triangularView<Upper>()
602 .solveInPlace(
c.topRows(nonzero_pivots));
608 template <
typename MatrixType_,
typename PermutationIndex_>
609 template <
bool Conjugate,
typename RhsType,
typename DstType>
611 DstType& dst)
const {
614 if (nonzero_pivots == 0) {
621 m_qr.topLeftCorner(nonzero_pivots, nonzero_pivots)
622 .template triangularView<Upper>()
624 .template conjugateIf<Conjugate>()
625 .solveInPlace(
c.topRows(nonzero_pivots));
627 dst.topRows(nonzero_pivots) =
c.topRows(nonzero_pivots);
628 dst.bottomRows(
rows() - nonzero_pivots).setZero();
630 dst.applyOnTheLeft(
householderQ().setLength(nonzero_pivots).
template conjugateIf<!Conjugate>());
636 template <
typename DstXprType,
typename MatrixType,
typename PermutationIndex>
639 typename ColPivHouseholderQR<MatrixType, PermutationIndex>::Scalar>,
654 template <
typename MatrixType,
typename PermutationIndex>
665 template <
typename Derived>
666 template <
typename PermutationIndexType>
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1149
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
Definition: StaticAssert.h:74
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Householder rank-revealing QR decomposition of a matrix with column-pivoting.
Definition: ColPivHouseholderQR.h:54
HouseholderSequence< MatrixType, internal::remove_all_t< typename HCoeffsType::ConjugateReturnType > > HouseholderSequenceType
Definition: ColPivHouseholderQR.h:72
RealScalar maxPivot() const
Definition: ColPivHouseholderQR.h:398
internal::plain_row_type< MatrixType >::type RowVectorType
Definition: ColPivHouseholderQR.h:69
MatrixType::PlainObject PlainObject
Definition: ColPivHouseholderQR.h:73
bool m_usePrescribedThreshold
Definition: ColPivHouseholderQR.h:433
const Inverse< ColPivHouseholderQR > inverse() const
Definition: ColPivHouseholderQR.h:321
Index rows() const
Definition: ColPivHouseholderQR.h:326
void computeInPlace()
Definition: ColPivHouseholderQR.h:488
MatrixType::Scalar signDeterminant() const
Definition: ColPivHouseholderQR.h:464
RealScalar m_maxpivot
Definition: ColPivHouseholderQR.h:434
Index rank() const
Definition: ColPivHouseholderQR.h:261
internal::plain_diag_type< MatrixType >::type HCoeffsType
Definition: ColPivHouseholderQR.h:66
HCoeffsType m_hCoeffs
Definition: ColPivHouseholderQR.h:427
RealRowVectorType m_colNormsUpdated
Definition: ColPivHouseholderQR.h:431
MatrixType::RealScalar absDeterminant() const
Definition: ColPivHouseholderQR.h:449
MatrixType_ MatrixType
Definition: ColPivHouseholderQR.h:56
RealScalar m_prescribedThreshold
Definition: ColPivHouseholderQR.h:434
PermutationType m_colsPermutation
Definition: ColPivHouseholderQR.h:428
RowVectorType m_temp
Definition: ColPivHouseholderQR.h:430
Index m_nonzero_pivots
Definition: ColPivHouseholderQR.h:435
internal::plain_row_type< MatrixType, RealScalar >::type RealRowVectorType
Definition: ColPivHouseholderQR.h:70
bool isSurjective() const
Definition: ColPivHouseholderQR.h:300
Index nonzeroPivots() const
Definition: ColPivHouseholderQR.h:390
bool isInjective() const
Definition: ColPivHouseholderQR.h:288
RealRowVectorType m_colNormsDirect
Definition: ColPivHouseholderQR.h:432
ColPivHouseholderQR(EigenBase< InputType > &matrix)
Constructs a QR factorization from a given matrix.
Definition: ColPivHouseholderQR.h:140
ColPivHouseholderQR & setThreshold(const RealScalar &threshold)
Definition: ColPivHouseholderQR.h:352
PermutationIndex_ PermutationIndex
Definition: ColPivHouseholderQR.h:59
Index cols() const
Definition: ColPivHouseholderQR.h:327
internal::plain_row_type< MatrixType, PermutationIndex >::type IntRowVectorType
Definition: ColPivHouseholderQR.h:68
MatrixType m_qr
Definition: ColPivHouseholderQR.h:426
const HCoeffsType & hCoeffs() const
Definition: ColPivHouseholderQR.h:333
bool isInvertible() const
Definition: ColPivHouseholderQR.h:311
PermutationMatrix< ColsAtCompileTime, MaxColsAtCompileTime, PermutationIndex > PermutationType
Definition: ColPivHouseholderQR.h:67
@ MaxRowsAtCompileTime
Definition: ColPivHouseholderQR.h:63
@ MaxColsAtCompileTime
Definition: ColPivHouseholderQR.h:64
void _solve_impl(const RhsType &rhs, DstType &dst) const
Definition: ColPivHouseholderQR.h:588
Index dimensionOfKernel() const
Definition: ColPivHouseholderQR.h:276
HouseholderSequenceType matrixQ() const
Definition: ColPivHouseholderQR.h:165
SolverBase< ColPivHouseholderQR > Base
Definition: ColPivHouseholderQR.h:57
ComputationInfo info() const
Reports whether the QR factorization was successful.
Definition: ColPivHouseholderQR.h:406
bool m_isInitialized
Definition: ColPivHouseholderQR.h:433
const PermutationType & colsPermutation() const
Definition: ColPivHouseholderQR.h:192
ColPivHouseholderQR()
Default Constructor.
Definition: ColPivHouseholderQR.h:95
HouseholderSequenceType householderQ() const
Definition: ColPivHouseholderQR.h:656
const MatrixType & matrixR() const
Definition: ColPivHouseholderQR.h:183
ColPivHouseholderQR & compute(const EigenBase< InputType > &matrix)
MatrixType::Scalar determinant() const
Definition: ColPivHouseholderQR.h:440
void init(Index rows, Index cols)
Definition: ColPivHouseholderQR.h:76
MatrixType::RealScalar logAbsDeterminant() const
Definition: ColPivHouseholderQR.h:457
RealScalar threshold() const
Definition: ColPivHouseholderQR.h:375
ColPivHouseholderQR & setThreshold(Default_t)
Definition: ColPivHouseholderQR.h:366
Index m_det_p
Definition: ColPivHouseholderQR.h:436
void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const
Definition: ColPivHouseholderQR.h:610
ColPivHouseholderQR(Index rows, Index cols)
Default Constructor with memory preallocation.
Definition: ColPivHouseholderQR.h:112
ColPivHouseholderQR(const EigenBase< InputType > &matrix)
Constructs a QR factorization from a given matrix.
Definition: ColPivHouseholderQR.h:127
const MatrixType & matrixQR() const
Definition: ColPivHouseholderQR.h:169
IntRowVectorType m_colsTranspositions
Definition: ColPivHouseholderQR.h:429
Complete orthogonal decomposition (COD) of a matrix.
Definition: CompleteOrthogonalDecomposition.h:54
Sequence of Householder reflections acting on subspaces with decreasing size.
Definition: HouseholderSequence.h:117
Expression of the inverse of another expression.
Definition: Inverse.h:43
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: Inverse.h:55
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: Inverse.h:54
EIGEN_DEVICE_FUNC const XprTypeNestedCleaned & nestedExpression() const
Definition: Inverse.h:57
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
const ColPivHouseholderQR< PlainObject, PermutationIndex > colPivHouseholderQr() const
InverseReturnType transpose() const
Definition: PermutationMatrix.h:177
void resize(Index newSize)
Definition: PermutationMatrix.h:119
Derived & applyTranspositionOnTheRight(Index i, Index j)
Definition: PermutationMatrix.h:162
void setIdentity()
Definition: PermutationMatrix.h:122
const IndicesType & indices() const
Definition: PermutationMatrix.h:334
Pseudo expression representing a solving operation.
Definition: Solve.h:62
A base class for matrix decomposition and solvers.
Definition: SolverBase.h:72
internal::traits< Derived >::Scalar Scalar
Definition: SolverBase.h:75
constexpr EIGEN_DEVICE_FUNC ColPivHouseholderQR< MatrixType_, PermutationIndex_ > & derived()
Definition: EigenBase.h:49
const Solve< ColPivHouseholderQR< MatrixType_, PermutationIndex_ >, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition: SolverBase.h:106
const AdjointReturnType adjoint() const
Definition: SolverBase.h:136
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85
ComputationInfo
Definition: Constants.h:438
@ Success
Definition: Constants.h:440
EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Definition: level1_impl.h:117
Scalar beta
Definition: level2_cplx_impl.h:36
const char const char const char * diag
Definition: level2_impl.h:86
char char char int int * k
Definition: level2_impl.h:374
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool is_exactly_zero(const X &x)
Definition: Meta.h:592
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float sqrt(const float &x)
Definition: arch/SSE/MathFunctions.h:69
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
Definition: MathFunctions.h:920
EIGEN_DEVICE_FUNC bool abs2(bool x)
Definition: MathFunctions.h:1102
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
auto run(Kernel kernel, Args &&... args) -> decltype(kernel(args...))
Definition: gpu_test_helper.h:414
Default_t
Definition: Constants.h:361
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
int c
Definition: calibrate.py:100
Definition: Eigen_Colamd.h:49
double epsilon
Definition: osc_ring_sarah_asymptotics.h:43
internal::nested_eval< T, 1 >::type eval(const T &xpr)
Definition: sparse_permutations.cpp:47
Definition: EigenBase.h:33
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:43
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition: EigenBase.h:64
Definition: Constants.h:534
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: Constants.h:525
Inverse< QrType > SrcXprType
Definition: ColPivHouseholderQR.h:642
ColPivHouseholderQR< MatrixType, PermutationIndex > QrType
Definition: ColPivHouseholderQR.h:641
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op< typename DstXprType::Scalar, typename QrType::Scalar > &)
Definition: ColPivHouseholderQR.h:643
Definition: AssignEvaluator.h:773
Definition: AssignEvaluator.h:756
Template functor for scalar/packet assignment.
Definition: AssignmentFunctors.h:25
Definition: HouseholderQR.h:280
std::conditional_t< is_same< typename traits< ExpressionType >::XprKind, MatrixXpr >::value, MatrixDiagType, ArrayDiagType > type
Definition: XprHelper.h:797
std::conditional_t< is_same< typename traits< ExpressionType >::XprKind, MatrixXpr >::value, MatrixRowType, ArrayRowType > type
Definition: XprHelper.h:768
MatrixXpr XprKind
Definition: ColPivHouseholderQR.h:22
SolverStorage StorageKind
Definition: ColPivHouseholderQR.h:23
PermutationIndex_ PermutationIndex
Definition: ColPivHouseholderQR.h:24
Definition: ForwardDeclarations.h:21
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2