Go to the documentation of this file.
11 #ifndef EIGEN_TRIANGULARMATRIX_H
12 #define EIGEN_TRIANGULARMATRIX_H
18 template<
int S
ide,
typename TriangularType,
typename Rhs>
struct triangular_solve_retval;
83 template<
typename Other>
103 #ifndef EIGEN_PARSED_BY_DOXYGEN
105 inline const Derived&
derived()
const {
return *
static_cast<const Derived*
>(
this); }
107 inline Derived&
derived() {
return *
static_cast<Derived*
>(
this); }
108 #endif // not EIGEN_PARSED_BY_DOXYGEN
110 template<
typename DenseDerived>
113 template<
typename DenseDerived>
140 #ifdef EIGEN_INTERNAL_DEBUGGING
169 template<
typename MatrixType,
unsigned int _Mode>
188 :
public TriangularViewImpl<_MatrixType, _Mode, typename internal::traits<_MatrixType>::StorageKind >
254 return ReturnType(
m_matrix.template conjugateIf<Cond>());
269 typename MatrixType::TransposeReturnType tmp(
m_matrix);
281 template<
typename Other>
289 template<
int S
ide,
typename Other>
293 {
return Base::template solve<Side>(
other); }
359 using Base::evalToLazy;
379 template<
typename Other>
386 template<
typename Other>
406 {
return *
this = MatrixType::Constant(derived().
rows(), derived().
cols(),
value); }
420 Base::check_coordinates_internal(
row,
col);
421 return derived().nestedExpression().coeff(
row,
col);
431 Base::check_coordinates_internal(
row,
col);
432 return derived().nestedExpression().coeffRef(
row,
col);
436 template<
typename OtherDerived>
441 template<
typename OtherDerived>
445 #ifndef EIGEN_PARSED_BY_DOXYGEN
448 {
return *
this =
other.derived().nestedExpression(); }
450 template<
typename OtherDerived>
455 template<
typename OtherDerived>
462 template<
typename OtherDerived>
471 template<
typename OtherDerived>
friend
502 template<
int S
ide,
typename Other>
515 template<
int S
ide,
typename OtherDerived>
519 template<
typename OtherDerived>
522 {
return solveInPlace<OnTheLeft>(
other); }
525 template<
typename OtherDerived>
527 #ifdef EIGEN_PARSED_BY_DOXYGEN
538 template<
typename OtherDerived>
547 template<
typename RhsType,
typename DstType>
552 this->solveInPlace(dst);
555 template<
typename ProductType>
568 #ifndef EIGEN_PARSED_BY_DOXYGEN
570 template<
typename MatrixType,
unsigned int Mode>
571 template<
typename OtherDerived>
573 TriangularViewImpl<MatrixType, Mode, Dense>::operator=(
const MatrixBase<OtherDerived>&
other)
580 template<
typename MatrixType,
unsigned int Mode>
581 template<
typename OtherDerived>
582 EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(
const MatrixBase<OtherDerived>&
other)
589 template<
typename MatrixType,
unsigned int Mode>
590 template<
typename OtherDerived>
592 TriangularViewImpl<MatrixType, Mode, Dense>::operator=(
const TriangularBase<OtherDerived>&
other)
599 template<
typename MatrixType,
unsigned int Mode>
600 template<
typename OtherDerived>
601 EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(
const TriangularBase<OtherDerived>&
other)
614 template<
typename Derived>
615 template<
typename DenseDerived>
618 evalToLazy(
other.derived());
640 template<
typename Derived>
641 template<
unsigned int Mode>
650 template<
typename Derived>
651 template<
unsigned int Mode>
664 template<
typename Derived>
674 if(absValue > maxAbsOnUpperPart) maxAbsOnUpperPart = absValue;
677 RealScalar threshold = maxAbsOnUpperPart * prec;
689 template<
typename Derived>
697 if(absValue > maxAbsOnLowerPart) maxAbsOnLowerPart = absValue;
699 RealScalar threshold = maxAbsOnLowerPart * prec;
722 template<
typename MatrixType,
unsigned int Mode>
729 template<
typename MatrixType,
unsigned int Mode>
731 :
evaluator<typename internal::remove_all<MatrixType>::type>
742 struct Dense2Triangular {};
753 template<
int UpLo,
int Mode,
int SetOpposite,
typename DstEvaluatorTypeT,
typename SrcEvaluatorTypeT,
typename Functor,
int Version = Specialized>
775 #ifdef EIGEN_INTERNAL_DEBUGGING
800 template<
int Mode,
bool SetOpposite,
typename DstXprType,
typename SrcXprType,
typename Functor>
804 typedef evaluator<DstXprType> DstEvaluatorType;
805 typedef evaluator<SrcXprType> SrcEvaluatorType;
807 SrcEvaluatorType srcEvaluator(src);
809 Index dstRows = src.rows();
810 Index dstCols = src.cols();
811 if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
812 dst.resize(dstRows, dstCols);
813 DstEvaluatorType dstEvaluator(dst);
816 DstEvaluatorType,SrcEvaluatorType,
Functor> Kernel;
817 Kernel kernel(dstEvaluator, srcEvaluator,
func, dst.const_cast_derived());
820 unroll = DstXprType::SizeAtCompileTime !=
Dynamic
821 && SrcEvaluatorType::CoeffReadCost <
HugeCost
822 && DstXprType::SizeAtCompileTime * (
int(DstEvaluatorType::CoeffReadCost) +
int(SrcEvaluatorType::CoeffReadCost)) / 2 <=
EIGEN_UNROLLING_LIMIT
825 triangular_assignment_loop<Kernel, Mode, unroll ?
int(DstXprType::SizeAtCompileTime) :
Dynamic, SetOpposite>::
run(kernel);
828 template<
int Mode,
bool SetOpposite,
typename DstXprType,
typename SrcXprType>
832 call_triangular_assignment_loop<Mode,SetOpposite>(dst, src, internal::assign_op<typename DstXprType::Scalar,typename SrcXprType::Scalar>());
837 template<>
struct AssignmentKind<TriangularShape,DenseShape> {
typedef Dense2Triangular
Kind; };
840 template<
typename DstXprType,
typename SrcXprType,
typename Functor>
847 call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src,
func);
851 template<
typename DstXprType,
typename SrcXprType,
typename Functor>
852 struct Assignment<DstXprType, SrcXprType,
Functor, Triangular2Dense>
856 call_triangular_assignment_loop<SrcXprType::Mode, (int(SrcXprType::Mode) & int(SelfAdjoint)) == 0>(dst, src,
func);
860 template<
typename DstXprType,
typename SrcXprType,
typename Functor>
865 call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src,
func);
870 template<
typename Kernel,
unsigned int Mode,
int UnrollCount,
bool SetOpposite>
878 col = (UnrollCount-1) / DstXprType::RowsAtCompileTime,
879 row = (UnrollCount-1) % DstXprType::RowsAtCompileTime
885 static inline void run(Kernel &kernel)
890 kernel.assignDiagonalCoeff(
row);
892 kernel.assignCoeff(
row,
col);
894 kernel.assignOppositeCoeff(
row,
col);
899 template<
typename Kernel,
unsigned int Mode,
bool SetOpposite>
900 struct triangular_assignment_loop<Kernel, Mode, 0, SetOpposite>
903 static inline void run(Kernel &) {}
912 template<
typename Kernel,
unsigned int Mode,
bool SetOpposite>
917 static inline void run(Kernel &kernel)
923 if (((Mode&
Lower) && SetOpposite) || (Mode&
Upper))
926 if(Mode&
Upper) kernel.assignCoeff(
i,
j);
927 else kernel.assignOppositeCoeff(
i,
j);
933 kernel.assignDiagonalCoeff(
i++);
935 if (((Mode&
Upper) && SetOpposite) || (Mode&
Lower))
937 for(;
i < kernel.rows(); ++
i)
938 if(Mode&
Lower) kernel.assignCoeff(
i,
j);
939 else kernel.assignOppositeCoeff(
i,
j);
949 template<
typename Derived>
950 template<
typename DenseDerived>
960 template<
typename DstXprType,
typename Lhs,
typename Rhs,
typename Scalar>
968 if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
969 dst.resize(dstRows, dstCols);
971 dst._assignProduct(src,
Scalar(1),
false);
976 template<
typename DstXprType,
typename Lhs,
typename Rhs,
typename Scalar>
982 dst._assignProduct(src,
Scalar(1),
true);
987 template<
typename DstXprType,
typename Lhs,
typename Rhs,
typename Scalar>
993 dst._assignProduct(src,
Scalar(-1),
true);
1001 #endif // EIGEN_TRIANGULARMATRIX_H
EIGEN_DEVICE_FUNC void swap(TriangularBase< OtherDerived > const &other)
EIGEN_DEVICE_FUNC void solveInPlace(const MatrixBase< OtherDerived > &other) const
const Functor & m_functor
EIGEN_DEVICE_FUNC Scalar & coeffRef(Index row, Index col)
EIGEN_DEVICE_FUNC Index innerStride() const
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op< Scalar, typename SrcXprType::Scalar > &)
internal::traits< TriangularView >::MatrixTypeNestedNonRef MatrixTypeNestedNonRef
#define EIGEN_DEVICE_FUNC
Namespace containing all symbols from the Eigen library.
TriangularBase< TriangularViewType > Base
EIGEN_DEVICE_FUNC internal::conditional< Cond, ConjugateReturnType, ConstTriangularView >::type conjugateIf() const
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC void swap(MatrixBase< OtherDerived > const &other)
remove_all< MatrixTypeNested >::type MatrixTypeNestedCleaned
Kernel::DstEvaluatorType DstEvaluatorType
#define EIGEN_UNROLLING_LIMIT
EIGEN_DEVICE_FUNC TriangularView(MatrixType &matrix)
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Eigen::Index Index
The interface type of indices.
#define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived)
remove_reference< MatrixTypeNested >::type MatrixTypeNestedNonRef
EIGEN_DEVICE_FUNC TriangularViewType & operator=(const TriangularViewImpl &other)
EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index row, Index col)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
const EIGEN_DEVICE_FUNC SelfAdjointView< MatrixTypeNestedNonRef, Mode > selfadjointView() const
TriangularView< typename MatrixType::TransposeReturnType, TransposeMode > TransposeReturnType
TriangularView< const typename MatrixType::AdjointReturnType, TransposeMode > AdjointReturnType
EIGEN_DEVICE_FUNC void evalToLazy(MatrixBase< DenseDerived > &other) const
static EIGEN_DEVICE_FUNC void run(Kernel &kernel)
friend const EIGEN_DEVICE_FUNC Product< OtherDerived, TriangularViewType > operator*(const MatrixBase< OtherDerived > &lhs, const TriangularViewImpl &rhs)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerStride() const EIGEN_NOEXCEPT
internal::remove_all< typename MatrixType::ConjugateReturnType >::type MatrixConjugateReturnType
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
MatrixTypeNested m_matrix
Base::DstXprType DstXprType
EIGEN_DEVICE_FUNC TransposeReturnType transpose()
Expression of a selfadjoint matrix from a triangular part of a dense matrix.
MatrixType::PlainObject FullMatrixType
TriangularView< const typename MatrixType::ConstTransposeReturnType, TransposeMode > ConstTransposeReturnType
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void copyCoeff(Index row, Index col, Other &other)
EIGEN_DEVICE_FUNC TriangularBase()
EIGEN_DEVICE_FUNC Scalar coeff(Index row, Index col) const
double beta(double a, double b)
EIGEN_DEVICE_FUNC Scalar & coeffRef(Index row, Index col)
SrcEvaluatorTypeT SrcEvaluatorType
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
#define eigen_internal_assert(x)
const unsigned int DirectAccessBit
DstEvaluatorTypeT DstEvaluatorType
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
const unsigned int PacketAccessBit
const EIGEN_DEVICE_FUNC ConjugateReturnType conjugate() const
DstEvaluatorType::Scalar Scalar
Base::AssignmentTraits AssignmentTraits
Base::SrcEvaluatorType SrcEvaluatorType
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerStride() const EIGEN_NOEXCEPT
internal::traits< Derived >::FullMatrixType DenseMatrixType
DenseMatrixType DenseType
NumTraits< Scalar >::Real RealScalar
internal::traits< TriangularView >::MatrixTypeNested MatrixTypeNested
DenseMatrixType PlainObject
generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version > Base
EIGEN_DEVICE_FUNC Index outerStride() const
TriangularView< _MatrixType, _Mode > TriangularViewType
#define EIGEN_UNUSED_VARIABLE(var)
TriangularView< typename internal::add_const< MatrixType >::type, _Mode > ConstTriangularView
internal::traits< TriangularView >::Scalar Scalar
const unsigned int LvalueBit
EIGEN_DEVICE_FUNC TriangularViewType & setZero()
EIGEN_DEVICE_FUNC Scalar operator()(Index row, Index col) const
DstEvaluatorType::XprType DstXprType
EIGEN_DEVICE_FUNC void fill(const Scalar &value)
Base class for triangular part in a matrix.
static const DiscreteKey mode(modeKey, 2)
const EIGEN_DEVICE_FUNC Product< TriangularViewType, OtherDerived > operator*(const MatrixBase< OtherDerived > &rhs) const
EIGEN_DEVICE_FUNC void evalTo(MatrixBase< DenseDerived > &other) const
ref_selector< MatrixType >::non_const_type MatrixTypeNested
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _solve_impl(const RhsType &rhs, DstType &dst) const
SrcEvaluatorTypeT::XprType SrcXprType
const EIGEN_DEVICE_FUNC ConstTransposeReturnType transpose() const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
EIGEN_DEVICE_FUNC NestedExpression & nestedExpression()
const SrcEvaluatorType & m_src
EIGEN_DEVICE_FUNC TriangularViewType & operator-=(const DenseBase< Other > &other)
#define EIGEN_STRONG_INLINE
static void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op< Scalar, typename SrcXprType::Scalar > &)
TriangularView< const MatrixConjugateReturnType, Mode > ConjugateReturnType
storage_kind_to_shape< typename traits< T >::StorageKind >::Shape Shape
MatrixType::PlainObject DenseMatrixType
Expression of the product of two arbitrary matrices or vectors.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
EIGEN_DEVICE_FUNC TriangularViewReturnType< Mode >::Type triangularView()
EIGEN_DEVICE_FUNC void resize(Index rows, Index cols)
EIGEN_DEVICE_FUNC TriangularViewType & operator*=(const typename internal::traits< MatrixType >::Scalar &other)
TriangularViewImpl< _MatrixType, _Mode, typename internal::traits< _MatrixType >::StorageKind > Base
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
#define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS)
CwiseBinaryOp< internal::scalar_sum_op< double, double >, const CpyMatrixXd, const CpyMatrixXd > XprType
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
EIGEN_DEVICE_FUNC Derived & derived()
EIGEN_DEVICE_FUNC Scalar determinant() const
bool isLowerTriangular(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
const unsigned int LinearAccessBit
EIGEN_DEVICE_FUNC TriangularViewType & setConstant(const Scalar &value)
internal::traits< TriangularView >::MatrixTypeNestedCleaned NestedExpression
Pseudo expression representing a solving operation.
const EIGEN_DEVICE_FUNC AdjointReturnType adjoint() const
EIGEN_DEVICE_FUNC Scalar coeff(Index row, Index col) const
Base class for all dense matrices, vectors, and arrays.
Base::DstEvaluatorType DstEvaluatorType
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEVICE_FUNC Scalar & operator()(Index row, Index col)
EIGEN_DEVICE_FUNC TriangularViewType & setOnes()
const EIGEN_DEVICE_FUNC NestedExpression & nestedExpression() const
Product< Lhs, Rhs, DefaultProduct > SrcXprType
const EIGEN_DEVICE_FUNC Solve< TriangularView, Other > solve(const MatrixBase< Other > &other) const
EIGEN_DEVICE_FUNC bool is_same_dense(const T1 &mat1, const T2 &mat2, typename enable_if< possibly_same_dense< T1, T2 >::value >::type *=0)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_triangular_assignment_loop(DstXprType &dst, const SrcXprType &src, const Functor &func)
internal::traits< TriangularViewType >::Scalar Scalar
storage_kind_to_evaluator_kind< typename traits< T >::StorageKind >::Kind Kind
DstEvaluatorTypeT::XprType DstXprType
MatrixType ExpressionType
void check_coordinates(Index row, Index col) const
EIGEN_DEVICE_FUNC TriangularViewType & operator+=(const DenseBase< Other > &other)
Product< Lhs, Rhs, DefaultProduct > SrcXprType
EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType &dstExpr)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typename NumTraits< T >::Real >::type abs(const T &x)
EIGEN_DEVICE_FUNC TriangularViewType & operator/=(const typename internal::traits< MatrixType >::Scalar &other)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index row, Index col)
Assign src(row,col) to dst(row,col) through the assignment functor.
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
internal::traits< Derived >::StorageKind StorageKind
Base class for all dense matrices, vectors, and expressions.
Base::SrcXprType SrcXprType
#define EIGEN_STATIC_ASSERT_LVALUE(Derived)
EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id)
internal::traits< TriangularView >::StorageKind StorageKind
const unsigned int HereditaryBits
Expression of a triangular part in a matrix.
int EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
static void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op< Scalar, typename SrcXprType::Scalar > &)
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
internal::traits< Derived >::Scalar Scalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment(Dst &dst, const Src &src)
internal::traits< Derived >::StorageIndex StorageIndex
const Product< Lhs, Rhs > prod(const Lhs &lhs, const Rhs &rhs)
const EIGEN_DEVICE_FUNC Derived & derived() const
void check_coordinates_internal(Index, Index) const
internal::traits< TriangularViewType >::StorageKind StorageKind
EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix() const
bool isUpperTriangular(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Product< Lhs, Rhs, DefaultProduct > SrcXprType
EIGEN_DEVICE_FUNC SelfAdjointView< MatrixTypeNestedNonRef, Mode > selfadjointView()
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:29