FullPivHouseholderQR.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H
12 #define EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H
13 
14 // IWYU pragma: private
15 #include "./InternalHeaderCheck.h"
16 
17 namespace Eigen {
18 
19 namespace internal {
20 
21 template <typename MatrixType_, typename PermutationIndex_>
22 struct traits<FullPivHouseholderQR<MatrixType_, PermutationIndex_> > : traits<MatrixType_> {
23  typedef MatrixXpr XprKind;
25  typedef PermutationIndex_ PermutationIndex;
26  enum { Flags = 0 };
27 };
28 
29 template <typename MatrixType, typename PermutationIndex>
30 struct FullPivHouseholderQRMatrixQReturnType;
31 
32 template <typename MatrixType, typename PermutationIndex>
34  typedef typename MatrixType::PlainObject ReturnType;
35 };
36 
37 } // end namespace internal
38 
62 template <typename MatrixType_, typename PermutationIndex_>
63 class FullPivHouseholderQR : public SolverBase<FullPivHouseholderQR<MatrixType_, PermutationIndex_> > {
64  public:
65  typedef MatrixType_ MatrixType;
67  friend class SolverBase<FullPivHouseholderQR>;
68  typedef PermutationIndex_ PermutationIndex;
70 
71  enum {
72  MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
73  MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
74  };
83  typedef typename MatrixType::PlainObject PlainObject;
84 
91  : m_qr(),
92  m_hCoeffs(),
96  m_temp(),
97  m_isInitialized(false),
98  m_usePrescribedThreshold(false) {}
99 
107  : m_qr(rows, cols),
108  m_hCoeffs((std::min)(rows, cols)),
112  m_temp(cols),
113  m_isInitialized(false),
114  m_usePrescribedThreshold(false) {}
115 
128  template <typename InputType>
130  : m_qr(matrix.rows(), matrix.cols()),
131  m_hCoeffs((std::min)(matrix.rows(), matrix.cols())),
135  m_temp(matrix.cols()),
136  m_isInitialized(false),
137  m_usePrescribedThreshold(false) {
138  compute(matrix.derived());
139  }
140 
148  template <typename InputType>
150  : m_qr(matrix.derived()),
151  m_hCoeffs((std::min)(matrix.rows(), matrix.cols())),
155  m_temp(matrix.cols()),
156  m_isInitialized(false),
157  m_usePrescribedThreshold(false) {
158  computeInPlace();
159  }
160 
161 #ifdef EIGEN_PARSED_BY_DOXYGEN
177  template <typename Rhs>
178  inline const Solve<FullPivHouseholderQR, Rhs> solve(const MatrixBase<Rhs>& b) const;
179 #endif
180 
184 
187  const MatrixType& matrixQR() const {
188  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
189  return m_qr;
190  }
191 
192  template <typename InputType>
194 
197  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
198  return m_cols_permutation;
199  }
200 
203  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
204  return m_rows_transpositions;
205  }
206 
220  typename MatrixType::Scalar determinant() const;
221 
236 
250 
264 
271  inline Index rank() const {
272  using std::abs;
273  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
274  RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold();
275  Index result = 0;
276  for (Index i = 0; i < m_nonzero_pivots; ++i) result += (abs(m_qr.coeff(i, i)) > premultiplied_threshold);
277  return result;
278  }
279 
286  inline Index dimensionOfKernel() const {
287  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
288  return cols() - rank();
289  }
290 
298  inline bool isInjective() const {
299  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
300  return rank() == cols();
301  }
302 
310  inline bool isSurjective() const {
311  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
312  return rank() == rows();
313  }
314 
321  inline bool isInvertible() const {
322  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
323  return isInjective() && isSurjective();
324  }
325 
331  inline const Inverse<FullPivHouseholderQR> inverse() const {
332  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
333  return Inverse<FullPivHouseholderQR>(*this);
334  }
335 
336  inline Index rows() const { return m_qr.rows(); }
337  inline Index cols() const { return m_qr.cols(); }
338 
343  const HCoeffsType& hCoeffs() const { return m_hCoeffs; }
344 
365  return *this;
366  }
367 
377  m_usePrescribedThreshold = false;
378  return *this;
379  }
380 
388  // this formula comes from experimenting (see "LU precision tuning" thread on the
389  // list) and turns out to be identical to Higham's formula used already in LDLt.
390  : NumTraits<Scalar>::epsilon() * RealScalar(m_qr.diagonalSize());
391  }
392 
400  inline Index nonzeroPivots() const {
401  eigen_assert(m_isInitialized && "LU is not initialized.");
402  return m_nonzero_pivots;
403  }
404 
408  RealScalar maxPivot() const { return m_maxpivot; }
409 
410 #ifndef EIGEN_PARSED_BY_DOXYGEN
411  template <typename RhsType, typename DstType>
412  void _solve_impl(const RhsType& rhs, DstType& dst) const;
413 
414  template <bool Conjugate, typename RhsType, typename DstType>
415  void _solve_impl_transposed(const RhsType& rhs, DstType& dst) const;
416 #endif
417 
418  protected:
420 
422 
434 };
435 
436 template <typename MatrixType, typename PermutationIndex>
438  eigen_assert(m_isInitialized && "HouseholderQR is not initialized.");
439  eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
440  Scalar detQ;
442  return isInjective() ? (detQ * Scalar(m_det_p)) * m_qr.diagonal().prod() : Scalar(0);
443 }
444 
445 template <typename MatrixType, typename PermutationIndex>
447  using std::abs;
448  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
449  eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
450  return isInjective() ? abs(m_qr.diagonal().prod()) : RealScalar(0);
451 }
452 
453 template <typename MatrixType, typename PermutationIndex>
455  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
456  eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
457  return isInjective() ? m_qr.diagonal().cwiseAbs().array().log().sum() : -NumTraits<RealScalar>::infinity();
458 }
459 
460 template <typename MatrixType, typename PermutationIndex>
462  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
463  eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
464  Scalar detQ;
466  return isInjective() ? (detQ * Scalar(m_det_p)) * m_qr.diagonal().array().sign().prod() : Scalar(0);
467 }
468 
475 template <typename MatrixType, typename PermutationIndex>
476 template <typename InputType>
478  const EigenBase<InputType>& matrix) {
479  m_qr = matrix.derived();
480  computeInPlace();
481  return *this;
482 }
483 
484 template <typename MatrixType, typename PermutationIndex>
487  using std::abs;
488  Index rows = m_qr.rows();
489  Index cols = m_qr.cols();
490  Index size = (std::min)(rows, cols);
491 
492  m_hCoeffs.resize(size);
493 
494  m_temp.resize(cols);
495 
497 
500  Index number_of_transpositions = 0;
501 
502  RealScalar biggest(0);
503 
504  m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case)
505  m_maxpivot = RealScalar(0);
506 
507  for (Index k = 0; k < size; ++k) {
508  Index row_of_biggest_in_corner, col_of_biggest_in_corner;
510  typedef typename Scoring::result_type Score;
511 
512  Score score = m_qr.bottomRightCorner(rows - k, cols - k)
513  .unaryExpr(Scoring())
514  .maxCoeff(&row_of_biggest_in_corner, &col_of_biggest_in_corner);
515  row_of_biggest_in_corner += k;
516  col_of_biggest_in_corner += k;
517  RealScalar biggest_in_corner =
518  internal::abs_knowing_score<Scalar>()(m_qr(row_of_biggest_in_corner, col_of_biggest_in_corner), score);
519  if (k == 0) biggest = biggest_in_corner;
520 
521  // if the corner is negligible, then we have less than full rank, and we can finish early
522  if (internal::isMuchSmallerThan(biggest_in_corner, biggest, m_precision)) {
524  for (Index i = k; i < size; i++) {
525  m_rows_transpositions.coeffRef(i) = internal::convert_index<PermutationIndex>(i);
526  m_cols_transpositions.coeffRef(i) = internal::convert_index<PermutationIndex>(i);
527  m_hCoeffs.coeffRef(i) = Scalar(0);
528  }
529  break;
530  }
531 
532  m_rows_transpositions.coeffRef(k) = internal::convert_index<PermutationIndex>(row_of_biggest_in_corner);
533  m_cols_transpositions.coeffRef(k) = internal::convert_index<PermutationIndex>(col_of_biggest_in_corner);
534  if (k != row_of_biggest_in_corner) {
535  m_qr.row(k).tail(cols - k).swap(m_qr.row(row_of_biggest_in_corner).tail(cols - k));
536  ++number_of_transpositions;
537  }
538  if (k != col_of_biggest_in_corner) {
539  m_qr.col(k).swap(m_qr.col(col_of_biggest_in_corner));
540  ++number_of_transpositions;
541  }
542 
544  m_qr.col(k).tail(rows - k).makeHouseholderInPlace(m_hCoeffs.coeffRef(k), beta);
545  m_qr.coeffRef(k, k) = beta;
546 
547  // remember the maximum absolute value of diagonal coefficients
548  if (abs(beta) > m_maxpivot) m_maxpivot = abs(beta);
549 
550  m_qr.bottomRightCorner(rows - k, cols - k - 1)
551  .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows - k - 1), m_hCoeffs.coeffRef(k), &m_temp.coeffRef(k + 1));
552  }
553 
556 
557  m_det_p = (number_of_transpositions % 2) ? -1 : 1;
558  m_isInitialized = true;
559 }
560 
561 #ifndef EIGEN_PARSED_BY_DOXYGEN
562 template <typename MatrixType_, typename PermutationIndex_>
563 template <typename RhsType, typename DstType>
564 void FullPivHouseholderQR<MatrixType_, PermutationIndex_>::_solve_impl(const RhsType& rhs, DstType& dst) const {
565  const Index l_rank = rank();
566 
567  // FIXME introduce nonzeroPivots() and use it here. and more generally,
568  // make the same improvements in this dec as in FullPivLU.
569  if (l_rank == 0) {
570  dst.setZero();
571  return;
572  }
573 
574  typename RhsType::PlainObject c(rhs);
575 
577  for (Index k = 0; k < l_rank; ++k) {
578  Index remainingSize = rows() - k;
579  c.row(k).swap(c.row(m_rows_transpositions.coeff(k)));
580  c.bottomRightCorner(remainingSize, rhs.cols())
581  .applyHouseholderOnTheLeft(m_qr.col(k).tail(remainingSize - 1), m_hCoeffs.coeff(k), &temp.coeffRef(0));
582  }
583 
584  m_qr.topLeftCorner(l_rank, l_rank).template triangularView<Upper>().solveInPlace(c.topRows(l_rank));
585 
586  for (Index i = 0; i < l_rank; ++i) dst.row(m_cols_permutation.indices().coeff(i)) = c.row(i);
587  for (Index i = l_rank; i < cols(); ++i) dst.row(m_cols_permutation.indices().coeff(i)).setZero();
588 }
589 
590 template <typename MatrixType_, typename PermutationIndex_>
591 template <bool Conjugate, typename RhsType, typename DstType>
593  DstType& dst) const {
594  const Index l_rank = rank();
595 
596  if (l_rank == 0) {
597  dst.setZero();
598  return;
599  }
600 
601  typename RhsType::PlainObject c(m_cols_permutation.transpose() * rhs);
602 
603  m_qr.topLeftCorner(l_rank, l_rank)
604  .template triangularView<Upper>()
605  .transpose()
606  .template conjugateIf<Conjugate>()
607  .solveInPlace(c.topRows(l_rank));
608 
609  dst.topRows(l_rank) = c.topRows(l_rank);
610  dst.bottomRows(rows() - l_rank).setZero();
611 
613  const Index size = (std::min)(rows(), cols());
614  for (Index k = size - 1; k >= 0; --k) {
615  Index remainingSize = rows() - k;
616 
617  dst.bottomRightCorner(remainingSize, dst.cols())
618  .applyHouseholderOnTheLeft(m_qr.col(k).tail(remainingSize - 1).template conjugateIf<!Conjugate>(),
619  m_hCoeffs.template conjugateIf<Conjugate>().coeff(k), &temp.coeffRef(0));
620 
621  dst.row(k).swap(dst.row(m_rows_transpositions.coeff(k)));
622  }
623 }
624 #endif
625 
626 namespace internal {
627 
628 template <typename DstXprType, typename MatrixType, typename PermutationIndex>
630  internal::assign_op<typename DstXprType::Scalar,
631  typename FullPivHouseholderQR<MatrixType, PermutationIndex>::Scalar>,
632  Dense2Dense> {
635  static void run(DstXprType& dst, const SrcXprType& src,
637  dst = src.nestedExpression().solve(MatrixType::Identity(src.rows(), src.cols()));
638  }
639 };
640 
647 template <typename MatrixType, typename PermutationIndex>
649  : public ReturnByValue<FullPivHouseholderQRMatrixQReturnType<MatrixType, PermutationIndex> > {
650  public:
653  typedef Matrix<typename MatrixType::Scalar, 1, MatrixType::RowsAtCompileTime, RowMajor, 1,
654  MatrixType::MaxRowsAtCompileTime>
656 
659  : m_qr(qr), m_hCoeffs(hCoeffs), m_rowsTranspositions(rowsTranspositions) {}
660 
661  template <typename ResultType>
662  void evalTo(ResultType& result) const {
663  const Index rows = m_qr.rows();
664  WorkVectorType workspace(rows);
665  evalTo(result, workspace);
666  }
667 
668  template <typename ResultType>
669  void evalTo(ResultType& result, WorkVectorType& workspace) const {
670  using numext::conj;
671  // compute the product H'_0 H'_1 ... H'_n-1,
672  // where H_k is the k-th Householder transformation I - h_k v_k v_k'
673  // and v_k is the k-th Householder vector [1,m_qr(k+1,k), m_qr(k+2,k), ...]
674  const Index rows = m_qr.rows();
675  const Index cols = m_qr.cols();
676  const Index size = (std::min)(rows, cols);
677  workspace.resize(rows);
678  result.setIdentity(rows, rows);
679  for (Index k = size - 1; k >= 0; k--) {
680  result.block(k, k, rows - k, rows - k)
681  .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows - k - 1), conj(m_hCoeffs.coeff(k)), &workspace.coeffRef(k));
682  result.row(k).swap(result.row(m_rowsTranspositions.coeff(k)));
683  }
684  }
685 
686  Index rows() const { return m_qr.rows(); }
687  Index cols() const { return m_qr.rows(); }
688 
689  protected:
690  typename MatrixType::Nested m_qr;
691  typename HCoeffsType::Nested m_hCoeffs;
692  typename IntDiagSizeVectorType::Nested m_rowsTranspositions;
693 };
694 
695 // template<typename MatrixType>
696 // struct evaluator<FullPivHouseholderQRMatrixQReturnType<MatrixType> >
697 // : public evaluator<ReturnByValue<FullPivHouseholderQRMatrixQReturnType<MatrixType> > >
698 // {};
699 
700 } // end namespace internal
701 
702 template <typename MatrixType, typename PermutationIndex>
705  eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
707 }
708 
713 template <typename Derived>
714 template <typename PermutationIndex>
718 }
719 
720 } // end namespace Eigen
721 
722 #endif // EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
AnnoyingScalar conj(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:133
int i
Definition: BiCGSTAB_step_by_step.cpp:9
HouseholderQR< MatrixXf > qr(A)
#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 full pivoting.
Definition: FullPivHouseholderQR.h:63
IntDiagSizeVectorType m_rows_transpositions
Definition: FullPivHouseholderQR.h:425
const MatrixType & matrixQR() const
Definition: FullPivHouseholderQR.h:187
const IntDiagSizeVectorType & rowsTranspositions() const
Definition: FullPivHouseholderQR.h:202
FullPivHouseholderQR & compute(const EigenBase< InputType > &matrix)
Index m_det_p
Definition: FullPivHouseholderQR.h:433
Index dimensionOfKernel() const
Definition: FullPivHouseholderQR.h:286
const PermutationType & colsPermutation() const
Definition: FullPivHouseholderQR.h:196
void computeInPlace()
Definition: FullPivHouseholderQR.h:485
RowVectorType m_temp
Definition: FullPivHouseholderQR.h:428
internal::plain_col_type< MatrixType >::type ColVectorType
Definition: FullPivHouseholderQR.h:82
IntDiagSizeVectorType m_cols_transpositions
Definition: FullPivHouseholderQR.h:426
MatrixQReturnType matrixQ(void) const
Definition: FullPivHouseholderQR.h:704
Index rows() const
Definition: FullPivHouseholderQR.h:336
RealScalar m_prescribedThreshold
Definition: FullPivHouseholderQR.h:430
const HCoeffsType & hCoeffs() const
Definition: FullPivHouseholderQR.h:343
bool isInjective() const
Definition: FullPivHouseholderQR.h:298
bool isInvertible() const
Definition: FullPivHouseholderQR.h:321
MatrixType::RealScalar logAbsDeterminant() const
Definition: FullPivHouseholderQR.h:454
Index rank() const
Definition: FullPivHouseholderQR.h:271
PermutationMatrix< ColsAtCompileTime, MaxColsAtCompileTime, PermutationIndex > PermutationType
Definition: FullPivHouseholderQR.h:80
bool m_usePrescribedThreshold
Definition: FullPivHouseholderQR.h:429
HCoeffsType m_hCoeffs
Definition: FullPivHouseholderQR.h:424
void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const
Definition: FullPivHouseholderQR.h:592
MatrixType m_qr
Definition: FullPivHouseholderQR.h:423
internal::plain_diag_type< MatrixType >::type HCoeffsType
Definition: FullPivHouseholderQR.h:76
bool isSurjective() const
Definition: FullPivHouseholderQR.h:310
RealScalar m_precision
Definition: FullPivHouseholderQR.h:432
internal::FullPivHouseholderQRMatrixQReturnType< MatrixType, PermutationIndex > MatrixQReturnType
Definition: FullPivHouseholderQR.h:75
RealScalar maxPivot() const
Definition: FullPivHouseholderQR.h:408
MatrixType::Scalar determinant() const
Definition: FullPivHouseholderQR.h:437
FullPivHouseholderQR()
Default Constructor.
Definition: FullPivHouseholderQR.h:90
void _solve_impl(const RhsType &rhs, DstType &dst) const
Definition: FullPivHouseholderQR.h:564
MatrixType::PlainObject PlainObject
Definition: FullPivHouseholderQR.h:83
MatrixType_ MatrixType
Definition: FullPivHouseholderQR.h:65
PermutationType m_cols_permutation
Definition: FullPivHouseholderQR.h:427
MatrixType::RealScalar absDeterminant() const
Definition: FullPivHouseholderQR.h:446
FullPivHouseholderQR(Index rows, Index cols)
Default Constructor with memory preallocation.
Definition: FullPivHouseholderQR.h:106
const Inverse< FullPivHouseholderQR > inverse() const
Definition: FullPivHouseholderQR.h:331
Index cols() const
Definition: FullPivHouseholderQR.h:337
FullPivHouseholderQR(const EigenBase< InputType > &matrix)
Constructs a QR factorization from a given matrix.
Definition: FullPivHouseholderQR.h:129
SolverBase< FullPivHouseholderQR > Base
Definition: FullPivHouseholderQR.h:66
bool m_isInitialized
Definition: FullPivHouseholderQR.h:429
FullPivHouseholderQR & setThreshold(const RealScalar &threshold)
Definition: FullPivHouseholderQR.h:362
FullPivHouseholderQR(EigenBase< InputType > &matrix)
Constructs a QR factorization from a given matrix.
Definition: FullPivHouseholderQR.h:149
Matrix< PermutationIndex, 1, internal::min_size_prefer_dynamic(ColsAtCompileTime, RowsAtCompileTime), RowMajor, 1, internal::min_size_prefer_fixed(MaxColsAtCompileTime, MaxRowsAtCompileTime)> IntDiagSizeVectorType
Definition: FullPivHouseholderQR.h:79
@ MaxColsAtCompileTime
Definition: FullPivHouseholderQR.h:73
@ MaxRowsAtCompileTime
Definition: FullPivHouseholderQR.h:72
internal::plain_row_type< MatrixType >::type RowVectorType
Definition: FullPivHouseholderQR.h:81
FullPivHouseholderQR & setThreshold(Default_t)
Definition: FullPivHouseholderQR.h:376
Index m_nonzero_pivots
Definition: FullPivHouseholderQR.h:431
RealScalar m_maxpivot
Definition: FullPivHouseholderQR.h:430
PermutationIndex_ PermutationIndex
Definition: FullPivHouseholderQR.h:68
Index nonzeroPivots() const
Definition: FullPivHouseholderQR.h:400
RealScalar threshold() const
Definition: FullPivHouseholderQR.h:385
MatrixType::Scalar signDeterminant() const
Definition: FullPivHouseholderQR.h:461
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 FullPivHouseholderQR< PlainObject, PermutationIndex > fullPivHouseholderQr() const
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Definition: PlainObjectBase.h:217
InverseReturnType transpose() const
Definition: PermutationMatrix.h:177
Derived & applyTranspositionOnTheRight(Index i, Index j)
Definition: PermutationMatrix.h:162
void setIdentity()
Definition: PermutationMatrix.h:122
const IndicesType & indices() const
Definition: PermutationMatrix.h:334
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:198
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Definition: PlainObjectBase.h:294
Definition: ReturnByValue.h:50
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 FullPivHouseholderQR< MatrixType_, PermutationIndex_ > & derived()
Definition: EigenBase.h:49
const Solve< FullPivHouseholderQR< MatrixType_, PermutationIndex_ >, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition: SolverBase.h:106
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
#define min(a, b)
Definition: datatypes.h:22
@ RowMajor
Definition: Constants.h:320
Scalar beta
Definition: level2_cplx_impl.h:36
res setZero()
char char char int int * k
Definition: level2_impl.h:374
constexpr int min_size_prefer_fixed(A a, B b)
Definition: Meta.h:683
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1916
constexpr int min_size_prefer_dynamic(A a, B b)
Definition: Meta.h:668
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
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
CleanedUpDerType< DerType >::type() min(const AutoDiffScalar< DerType > &x, const T &y)
Definition: AutoDiffScalar.h:494
Default_t
Definition: Constants.h:361
const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
Definition: AutoDiffScalar.h:482
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 void evalTo(Dest &dst) const
Definition: EigenBase.h:68
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
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op< typename DstXprType::Scalar, typename QrType::Scalar > &)
Definition: FullPivHouseholderQR.h:635
Definition: AssignEvaluator.h:773
Definition: AssignEvaluator.h:756
Expression type for return value of FullPivHouseholderQR::matrixQ()
Definition: FullPivHouseholderQR.h:649
internal::plain_diag_type< MatrixType >::type HCoeffsType
Definition: FullPivHouseholderQR.h:652
void evalTo(ResultType &result) const
Definition: FullPivHouseholderQR.h:662
Matrix< typename MatrixType::Scalar, 1, MatrixType::RowsAtCompileTime, RowMajor, 1, MatrixType::MaxRowsAtCompileTime > WorkVectorType
Definition: FullPivHouseholderQR.h:655
Index rows() const
Definition: FullPivHouseholderQR.h:686
FullPivHouseholderQR< MatrixType, PermutationIndex >::IntDiagSizeVectorType IntDiagSizeVectorType
Definition: FullPivHouseholderQR.h:651
void evalTo(ResultType &result, WorkVectorType &workspace) const
Definition: FullPivHouseholderQR.h:669
IntDiagSizeVectorType::Nested m_rowsTranspositions
Definition: FullPivHouseholderQR.h:692
FullPivHouseholderQRMatrixQReturnType(const MatrixType &qr, const HCoeffsType &hCoeffs, const IntDiagSizeVectorType &rowsTranspositions)
Definition: FullPivHouseholderQR.h:657
HCoeffsType::Nested m_hCoeffs
Definition: FullPivHouseholderQR.h:691
Index cols() const
Definition: FullPivHouseholderQR.h:687
MatrixType::Nested m_qr
Definition: FullPivHouseholderQR.h:690
Definition: functors/UnaryFunctors.h:71
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, MatrixColType, ArrayColType > type
Definition: XprHelper.h:782
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
Template functor to compute the score of a scalar, to chose a pivot.
Definition: functors/UnaryFunctors.h:63
PermutationIndex_ PermutationIndex
Definition: FullPivHouseholderQR.h:25
Definition: ForwardDeclarations.h:21