60 template<
typename _MatrixType>
class FullPivLU 70 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
71 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
100 template<
typename InputType>
109 template<
typename InputType>
119 template<
typename InputType>
134 eigen_assert(m_isInitialized &&
"LU is not initialized.");
147 eigen_assert(m_isInitialized &&
"LU is not initialized.");
148 return m_nonzero_pivots;
162 eigen_assert(m_isInitialized &&
"LU is not initialized.");
172 eigen_assert(m_isInitialized &&
"LU is not initialized.");
192 eigen_assert(m_isInitialized &&
"LU is not initialized.");
216 image(
const MatrixType& originalMatrix)
const 218 eigen_assert(m_isInitialized &&
"LU is not initialized.");
222 #ifdef EIGEN_PARSED_BY_DOXYGEN 242 template<
typename Rhs>
252 eigen_assert(m_isInitialized &&
"PartialPivLU is not initialized.");
292 m_usePrescribedThreshold =
true;
293 m_prescribedThreshold = threshold;
307 m_usePrescribedThreshold =
false;
317 eigen_assert(m_isInitialized || m_usePrescribedThreshold);
318 return m_usePrescribedThreshold ? m_prescribedThreshold
333 eigen_assert(m_isInitialized &&
"LU is not initialized.");
334 RealScalar premultiplied_threshold =
abs(m_maxpivot) * threshold();
336 for(
Index i = 0;
i < m_nonzero_pivots; ++
i)
337 result += (
abs(m_lu.coeff(
i,
i)) > premultiplied_threshold);
349 eigen_assert(m_isInitialized &&
"LU is not initialized.");
350 return cols() - rank();
362 eigen_assert(m_isInitialized &&
"LU is not initialized.");
363 return rank() ==
cols();
375 eigen_assert(m_isInitialized &&
"LU is not initialized.");
376 return rank() ==
rows();
387 eigen_assert(m_isInitialized &&
"LU is not initialized.");
388 return isInjective() && (m_lu.rows() == m_lu.cols());
400 eigen_assert(m_isInitialized &&
"LU is not initialized.");
401 eigen_assert(m_lu.rows() == m_lu.cols() &&
"You can't take the inverse of a non-square matrix!");
405 MatrixType reconstructedMatrix()
const;
412 #ifndef EIGEN_PARSED_BY_DOXYGEN 413 template<
typename RhsType,
typename DstType>
414 void _solve_impl(
const RhsType &rhs, DstType &dst)
const;
416 template<
bool Conjugate,
typename RhsType,
typename DstType>
417 void _solve_impl_transposed(
const RhsType &rhs, DstType &dst)
const;
427 void computeInPlace();
441 template<
typename MatrixType>
443 : m_isInitialized(false), m_usePrescribedThreshold(false)
447 template<
typename MatrixType>
459 template<
typename MatrixType>
460 template<
typename InputType>
473 template<
typename MatrixType>
474 template<
typename InputType>
487 template<
typename MatrixType>
505 Index number_of_transpositions = 0;
515 Index row_of_biggest_in_corner, col_of_biggest_in_corner;
517 typedef typename Scoring::result_type Score;
518 Score biggest_in_corner;
519 biggest_in_corner =
m_lu.bottomRightCorner(rows-k, cols-k)
520 .unaryExpr(Scoring())
521 .maxCoeff(&row_of_biggest_in_corner, &col_of_biggest_in_corner);
522 row_of_biggest_in_corner += k;
523 col_of_biggest_in_corner += k;
525 if(biggest_in_corner==Score(0))
544 m_rowsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(row_of_biggest_in_corner);
545 m_colsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(col_of_biggest_in_corner);
546 if(k != row_of_biggest_in_corner) {
547 m_lu.row(k).swap(
m_lu.row(row_of_biggest_in_corner));
548 ++number_of_transpositions;
550 if(k != col_of_biggest_in_corner) {
551 m_lu.col(k).swap(
m_lu.col(col_of_biggest_in_corner));
552 ++number_of_transpositions;
559 m_lu.col(k).tail(rows-k-1) /=
m_lu.coeff(k,k);
561 m_lu.block(k+1,k+1,rows-k-1,cols-k-1).noalias() -=
m_lu.col(k).tail(rows-k-1) *
m_lu.row(k).tail(cols-k-1);
568 for(
Index k = size-1; k >= 0; --k)
575 m_det_pq = (number_of_transpositions%2) ? -1 : 1;
580 template<
typename MatrixType>
584 eigen_assert(
m_lu.rows() ==
m_lu.cols() &&
"You can't take the determinant of a non-square matrix!");
591 template<
typename MatrixType>
600 .template triangularView<UnitLower>().toDenseMatrix()
601 *
m_lu.topRows(smalldim)
602 .template triangularView<Upper>().toDenseMatrix();
616 template<
typename _MatrixType>
623 MatrixType::MaxColsAtCompileTime,
624 MatrixType::MaxRowsAtCompileTime)
627 template<
typename Dest>
void evalTo(Dest& dst)
const 630 const Index cols = dec().matrixLU().cols(), dimker = cols -
rank();
657 RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold();
659 for(
Index i = 0;
i < dec().nonzeroPivots(); ++
i)
660 if(
abs(dec().
matrixLU().coeff(
i,
i)) > premultiplied_threshold)
669 MaxSmallDimAtCompileTime, MatrixType::MaxColsAtCompileTime>
673 if(
i) m.row(
i).head(
i).setZero();
674 m.row(
i).tail(cols-
i) = dec().matrixLU().row(pivots.
coeff(
i)).
tail(cols-
i);
677 m.block(0, 0,
rank(),
rank()).template triangularView<StrictlyLower>().
setZero();
679 m.col(
i).swap(m.col(pivots.
coeff(
i)));
685 .template triangularView<Upper>().solveInPlace(
686 m.topRightCorner(rank(), dimker)
691 m.col(
i).swap(m.col(pivots.
coeff(
i)));
702 template<
typename _MatrixType>
709 MatrixType::MaxColsAtCompileTime,
710 MatrixType::MaxRowsAtCompileTime)
713 template<
typename Dest>
void evalTo(Dest& dst)
const 726 RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold();
728 for(
Index i = 0;
i < dec().nonzeroPivots(); ++
i)
729 if(
abs(dec().
matrixLU().coeff(
i,
i)) > premultiplied_threshold)
742 #ifndef EIGEN_PARSED_BY_DOXYGEN 743 template<
typename _MatrixType>
744 template<
typename RhsType,
typename DstType>
757 nonzero_pivots = this->
rank();
760 if(nonzero_pivots == 0)
766 typename RhsType::PlainObject
c(rhs.rows(), rhs.cols());
772 m_lu.topLeftCorner(smalldim,smalldim)
773 .template triangularView<UnitLower>()
774 .solveInPlace(c.topRows(smalldim));
779 m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
780 .template triangularView<Upper>()
781 .solveInPlace(c.topRows(nonzero_pivots));
784 for(
Index i = 0;
i < nonzero_pivots; ++
i)
790 template<
typename _MatrixType>
791 template<
bool Conjugate,
typename RhsType,
typename DstType>
806 nonzero_pivots = this->
rank();
809 if(nonzero_pivots == 0)
815 typename RhsType::PlainObject
c(rhs.rows(), rhs.cols());
821 m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
822 .template triangularView<Upper>()
824 .template conjugateIf<Conjugate>()
825 .solveInPlace(c.topRows(nonzero_pivots));
828 m_lu.topLeftCorner(smalldim, smalldim)
829 .template triangularView<UnitLower>()
831 .template conjugateIf<Conjugate>()
832 .solveInPlace(c.topRows(smalldim));
837 dst.row(invp.indices().coeff(
i)) = c.row(
i);
839 dst.row(invp.indices().coeff(
i)).
setZero();
848 template<
typename DstXprType,
typename MatrixType>
868 template<
typename Derived>
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
internal::plain_row_type< MatrixType, StorageIndex >::type IntRowVectorType
PermutationMatrix< ColsAtCompileTime, MaxColsAtCompileTime > PermutationQType
void evalTo(Dest &dst) const
bool m_usePrescribedThreshold
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
const internal::image_retval< FullPivLU > image(const MatrixType &originalMatrix) const
SolverBase< FullPivLU > Base
FullPivLU< MatrixType > LuType
m m block(1, 0, 2, 2)<< 4
internal::traits< FullPivLU< _MatrixType > >::Scalar Scalar
FullPivLU & setThreshold(const RealScalar &threshold)
RealScalar m_prescribedThreshold
InverseReturnType inverse() const
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
void determinant(const MatrixType &m)
FullPivLU & compute(const EigenBase< InputType > &matrix)
const PermutationQType & permutationQ() const
Derived & applyTranspositionOnTheRight(Index i, Index j)
Namespace containing all symbols from the Eigen library.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE FixedSegmentReturnType< internal::get_fixed_value< NType >::value >::Type tail(NType n)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
void _solve_impl(const RhsType &rhs, DstType &dst) const
Decomposition::RealScalar rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition &dec)
Reciprocal condition number estimator.
Eigen::Index Index
The interface type of indices.
const FullPivLU< PlainObject > fullPivLu() const
#define EIGEN_SIZE_MIN_PREFER_FIXED(a, b)
Index nonzeroPivots() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Expression of the inverse of another expression.
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
RealScalar threshold() const
internal::traits< MatrixType >::Scalar determinant() const
const MatrixType & matrixLU() const
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
IntRowVectorType m_colsTranspositions
ConstTransposeReturnType transpose() const
FullPivLU & setThreshold(Default_t)
void evalTo(Dest &dst) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const Inverse< FullPivLU > inverse() const
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op< typename DstXprType::Scalar, typename MatrixType::Scalar > &)
static void check_template_parameters()
void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
bool isSurjective() const
MatrixType reconstructedMatrix() const
PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime > PermutationPType
NumTraits< Scalar >::Real RealScalar
bool isInvertible() const
SolverStorage StorageKind
#define EIGEN_DEVICE_FUNC
internal::plain_col_type< MatrixType, StorageIndex >::type IntColVectorType
#define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType)
const internal::kernel_retval< FullPivLU > kernel() const
LU decomposition of a matrix with complete pivoting, and related features.
FullPivLU()
Default Constructor.
IntColVectorType m_rowsTranspositions
#define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType)
EIGEN_DEVICE_FUNC const PermutationPType & permutationP() const
internal::nested_eval< T, 1 >::type eval(const T &xpr)
Inverse< LuType > SrcXprType
Pseudo expression representing a solving operation.
Index dimensionOfKernel() const
#define eigen_internal_assert(x)
Generic expression where a coefficient-wise unary operator is applied to an expression.
MatrixType::PlainObject PlainObject
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
The matrix class, also used for vectors and row-vectors.
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
A base class for matrix decomposition and solvers.
EIGEN_DEVICE_FUNC Derived & derived()
Base class for all dense matrices, vectors, and expressions.
RealScalar maxPivot() const
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
EIGEN_DEVICE_FUNC const XprTypeNestedCleaned & nestedExpression() const