11 #ifndef EIGEN_TRIANGULARMATRIX_H 12 #define EIGEN_TRIANGULARMATRIX_H 15 #include "./InternalHeaderCheck.h" 21 template <
int S
ide,
typename TriangularType,
typename Rhs>
22 struct triangular_solve_retval;
31 template <
typename Derived>
35 Mode = internal::traits<Derived>::Mode,
36 RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
37 ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
38 MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
39 MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
46 MaxSizeAtCompileTime = internal::size_at_compile_time(internal::traits<Derived>::MaxRowsAtCompileTime,
47 internal::traits<Derived>::MaxColsAtCompileTime)
50 typedef typename internal::traits<Derived>::Scalar Scalar;
51 typedef typename internal::traits<Derived>::StorageKind StorageKind;
52 typedef typename internal::traits<Derived>::StorageIndex StorageIndex;
53 typedef typename internal::traits<Derived>::FullMatrixType DenseMatrixType;
54 typedef DenseMatrixType DenseType;
55 typedef Derived
const& Nested;
61 EIGEN_DEVICE_FUNC constexpr
Index rows() const noexcept {
return derived().rows(); }
62 EIGEN_DEVICE_FUNC constexpr
Index cols() const noexcept {
return derived().cols(); }
63 EIGEN_DEVICE_FUNC constexpr
Index outerStride() const noexcept {
return derived().outerStride(); }
64 EIGEN_DEVICE_FUNC constexpr
Index innerStride() const noexcept {
return derived().innerStride(); }
67 EIGEN_DEVICE_FUNC
void resize(
Index rows,
Index cols) {
68 EIGEN_UNUSED_VARIABLE(rows);
69 EIGEN_UNUSED_VARIABLE(cols);
70 eigen_assert(rows == this->rows() && cols == this->cols());
73 EIGEN_DEVICE_FUNC
inline Scalar coeff(
Index row,
Index col)
const {
return derived().coeff(row, col); }
74 EIGEN_DEVICE_FUNC
inline Scalar& coeffRef(
Index row,
Index col) {
return derived().coeffRef(row, col); }
78 template <
typename Other>
80 derived().coeffRef(row, col) = other.coeff(row, col);
83 EIGEN_DEVICE_FUNC
inline Scalar operator()(
Index row,
Index col)
const {
84 check_coordinates(row, col);
85 return coeff(row, col);
87 EIGEN_DEVICE_FUNC
inline Scalar& operator()(
Index row,
Index col) {
88 check_coordinates(row, col);
89 return coeffRef(row, col);
92 #ifndef EIGEN_PARSED_BY_DOXYGEN 93 EIGEN_DEVICE_FUNC
inline const Derived&
derived()
const {
return *
static_cast<const Derived*
>(
this); }
94 EIGEN_DEVICE_FUNC
inline Derived&
derived() {
return *
static_cast<Derived*
>(
this); }
95 #endif // not EIGEN_PARSED_BY_DOXYGEN 97 template <
typename DenseDerived>
98 EIGEN_DEVICE_FUNC
void evalTo(MatrixBase<DenseDerived>& other)
const;
99 template <
typename DenseDerived>
100 EIGEN_DEVICE_FUNC
void evalToLazy(MatrixBase<DenseDerived>& other)
const;
102 EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix()
const {
103 DenseMatrixType res(rows(), cols());
109 void check_coordinates(
Index row,
Index col)
const {
110 EIGEN_ONLY_USED_FOR_DEBUG(row);
111 EIGEN_ONLY_USED_FOR_DEBUG(col);
112 eigen_assert(col >= 0 && col < cols() && row >= 0 && row < rows());
114 EIGEN_ONLY_USED_FOR_DEBUG(mode);
115 eigen_assert((mode ==
Upper && col >= row) || (mode ==
Lower && col <= row) ||
120 #ifdef EIGEN_INTERNAL_DEBUGGING 121 void check_coordinates_internal(
Index row,
Index col)
const { check_coordinates(row, col); }
123 void check_coordinates_internal(
Index,
Index)
const {}
146 template <
typename MatrixType,
unsigned int Mode_>
147 struct traits<TriangularView<MatrixType, Mode_>> : traits<MatrixType> {
148 typedef typename ref_selector<MatrixType>::non_const_type MatrixTypeNested;
149 typedef std::remove_reference_t<MatrixTypeNested> MatrixTypeNestedNonRef;
150 typedef remove_all_t<MatrixTypeNested> MatrixTypeNestedCleaned;
151 typedef typename MatrixType::PlainObject FullMatrixType;
152 typedef MatrixType ExpressionType;
155 FlagsLvalueBit = is_lvalue<MatrixType>::value ?
LvalueBit : 0,
156 Flags = (MatrixTypeNestedCleaned::Flags & (HereditaryBits | FlagsLvalueBit) &
162 template <
typename MatrixType_,
unsigned int Mode_,
typename StorageKind>
163 class TriangularViewImpl;
165 template <
typename MatrixType_,
unsigned int Mode_>
167 :
public TriangularViewImpl<MatrixType_, Mode_, typename internal::traits<MatrixType_>::StorageKind> {
169 typedef TriangularViewImpl<MatrixType_, Mode_, typename internal::traits<MatrixType_>::StorageKind> Base;
170 typedef typename internal::traits<TriangularView>::Scalar Scalar;
171 typedef MatrixType_ MatrixType;
174 typedef typename internal::traits<TriangularView>::MatrixTypeNested MatrixTypeNested;
175 typedef typename internal::traits<TriangularView>::MatrixTypeNestedNonRef MatrixTypeNestedNonRef;
177 typedef internal::remove_all_t<typename MatrixType::ConjugateReturnType> MatrixConjugateReturnType;
181 typedef typename internal::traits<TriangularView>::StorageKind StorageKind;
182 typedef typename internal::traits<TriangularView>::MatrixTypeNestedCleaned NestedExpression;
186 Flags = internal::traits<TriangularView>::Flags,
189 IsVectorAtCompileTime =
false 192 EIGEN_DEVICE_FUNC
explicit inline TriangularView(MatrixType& matrix) : m_matrix(matrix) {}
197 EIGEN_DEVICE_FUNC constexpr
Index rows() const noexcept {
return m_matrix.rows(); }
199 EIGEN_DEVICE_FUNC constexpr
Index cols() const noexcept {
return m_matrix.cols(); }
217 EIGEN_DEVICE_FUNC
inline std::conditional_t<Cond, ConjugateReturnType, ConstTriangularView>
conjugateIf()
const {
218 typedef std::conditional_t<Cond, ConjugateReturnType, ConstTriangularView> ReturnType;
219 return ReturnType(m_matrix.template conjugateIf<Cond>());
228 template <
class Dummy =
int>
230 std::enable_if_t<Eigen::internal::is_lvalue<MatrixType>::value, Dummy*> =
nullptr) {
231 typename MatrixType::TransposeReturnType tmp(m_matrix);
241 template <
typename Other>
248 template <
int S
ide,
typename Other>
249 EIGEN_DEVICE_FUNC
inline const internal::triangular_solve_retval<Side, TriangularView, Other> solve(
250 const MatrixBase<Other>& other)
const {
251 return Base::template solve<Side>(other);
262 EIGEN_STATIC_ASSERT((Mode & (
UnitDiag |
ZeroDiag)) == 0, PROGRAMMING_ERROR);
268 EIGEN_STATIC_ASSERT((Mode & (
UnitDiag |
ZeroDiag)) == 0, PROGRAMMING_ERROR);
280 return m_matrix.diagonal().prod();
284 MatrixTypeNested m_matrix;
296 template <
typename MatrixType_,
unsigned int Mode_>
297 class TriangularViewImpl<MatrixType_, Mode_,
Dense> :
public TriangularBase<TriangularView<MatrixType_, Mode_>> {
302 typedef typename internal::traits<TriangularViewType>::Scalar Scalar;
304 typedef MatrixType_ MatrixType;
305 typedef typename MatrixType::PlainObject DenseMatrixType;
306 typedef DenseMatrixType PlainObject;
310 using Base::evalToLazy;
312 typedef typename internal::traits<TriangularViewType>::StorageKind StorageKind;
314 enum { Mode = Mode_, Flags = internal::traits<TriangularViewType>::Flags };
318 EIGEN_DEVICE_FUNC
inline Index outerStride()
const {
return derived().nestedExpression().outerStride(); }
321 EIGEN_DEVICE_FUNC
inline Index innerStride()
const {
return derived().nestedExpression().innerStride(); }
324 template <
typename Other>
326 internal::call_assignment_no_alias(derived(), other.
derived(),
327 internal::add_assign_op<Scalar, typename Other::Scalar>());
331 template <
typename Other>
333 internal::call_assignment_no_alias(derived(), other.
derived(),
334 internal::sub_assign_op<Scalar, typename Other::Scalar>());
348 EIGEN_DEVICE_FUNC
void fill(
const Scalar& value) { setConstant(value); }
351 return *
this = MatrixType::Constant(derived().rows(), derived().cols(), value);
362 Base::check_coordinates_internal(row, col);
363 return derived().nestedExpression().coeff(row, col);
371 Base::check_coordinates_internal(row, col);
372 return derived().nestedExpression().coeffRef(row, col);
376 template <
typename OtherDerived>
380 template <
typename OtherDerived>
383 #ifndef EIGEN_PARSED_BY_DOXYGEN 384 EIGEN_DEVICE_FUNC TriangularViewType& operator=(
const TriangularViewImpl& other) {
385 return *
this = other.derived().nestedExpression();
388 template <
typename OtherDerived>
390 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC
void lazyAssign(
const TriangularBase<OtherDerived>& other);
392 template <
typename OtherDerived>
394 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC
void lazyAssign(
const MatrixBase<OtherDerived>& other);
398 template <
typename OtherDerived>
405 template <
typename OtherDerived>
434 template <
int S
ide,
typename Other>
435 inline const internal::triangular_solve_retval<Side, TriangularViewType, Other> solve(
447 template <
int S
ide,
typename OtherDerived>
450 template <
typename OtherDerived>
452 return solveInPlace<OnTheLeft>(other);
456 template <
typename OtherDerived>
458 #ifdef EIGEN_PARSED_BY_DOXYGEN 466 EIGEN_STATIC_ASSERT_LVALUE(OtherDerived);
467 call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
471 template <
typename OtherDerived>
474 EIGEN_STATIC_ASSERT_LVALUE(OtherDerived);
475 call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
478 template <
typename RhsType,
typename DstType>
479 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void _solve_impl(
const RhsType& rhs, DstType& dst)
const {
480 if (!internal::is_same_dense(dst, rhs)) dst = rhs;
481 this->solveInPlace(dst);
484 template <
typename ProductType>
485 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TriangularViewType& _assignProduct(
const ProductType& prod,
const Scalar& alpha,
489 EIGEN_DEFAULT_COPY_CONSTRUCTOR(TriangularViewImpl)
490 EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(TriangularViewImpl)
497 #ifndef EIGEN_PARSED_BY_DOXYGEN 499 template <
typename MatrixType,
unsigned int Mode>
500 template <
typename OtherDerived>
501 EIGEN_DEVICE_FUNC
inline TriangularView<MatrixType, Mode>& TriangularViewImpl<MatrixType, Mode, Dense>::operator=(
502 const MatrixBase<OtherDerived>& other) {
503 internal::call_assignment_no_alias(derived(), other.derived(),
504 internal::assign_op<Scalar, typename OtherDerived::Scalar>());
509 template <
typename MatrixType,
unsigned int Mode>
510 template <
typename OtherDerived>
511 EIGEN_DEVICE_FUNC
void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(
const MatrixBase<OtherDerived>& other) {
512 internal::call_assignment_no_alias(derived(), other.template triangularView<Mode>());
515 template <
typename MatrixType,
unsigned int Mode>
516 template <
typename OtherDerived>
517 EIGEN_DEVICE_FUNC
inline TriangularView<MatrixType, Mode>& TriangularViewImpl<MatrixType, Mode, Dense>::operator=(
518 const TriangularBase<OtherDerived>& other) {
519 eigen_assert(Mode ==
int(OtherDerived::Mode));
520 internal::call_assignment(derived(), other.derived());
524 template <
typename MatrixType,
unsigned int Mode>
525 template <
typename OtherDerived>
526 EIGEN_DEVICE_FUNC
void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(
527 const TriangularBase<OtherDerived>& other) {
528 eigen_assert(Mode ==
int(OtherDerived::Mode));
529 internal::call_assignment_no_alias(derived(), other.derived());
539 template <
typename Derived>
540 template <
typename DenseDerived>
564 template <
typename Derived>
565 template <
unsigned int Mode>
568 return typename TriangularViewReturnType<Mode>::Type(derived());
572 template <
typename Derived>
573 template <
unsigned int Mode>
576 return typename ConstTriangularViewReturnType<Mode>::Type(derived());
584 template <
typename Derived>
586 RealScalar maxAbsOnUpperPart =
static_cast<RealScalar
>(-1);
587 for (
Index j = 0; j < cols(); ++j) {
588 Index maxi = numext::mini(j, rows() - 1);
589 for (
Index i = 0; i <= maxi; ++i) {
590 RealScalar absValue = numext::abs(coeff(i, j));
591 if (absValue > maxAbsOnUpperPart) maxAbsOnUpperPart = absValue;
594 RealScalar threshold = maxAbsOnUpperPart * prec;
595 for (
Index j = 0; j < cols(); ++j)
596 for (
Index i = j + 1; i < rows(); ++i)
597 if (numext::abs(coeff(i, j)) > threshold)
return false;
606 template <
typename Derived>
608 RealScalar maxAbsOnLowerPart =
static_cast<RealScalar
>(-1);
609 for (
Index j = 0; j < cols(); ++j)
610 for (
Index i = j; i < rows(); ++i) {
611 RealScalar absValue = numext::abs(coeff(i, j));
612 if (absValue > maxAbsOnLowerPart) maxAbsOnLowerPart = absValue;
614 RealScalar threshold = maxAbsOnLowerPart * prec;
615 for (
Index j = 1; j < cols(); ++j) {
616 Index maxi = numext::mini(j, rows() - 1);
617 for (
Index i = 0; i < maxi; ++i)
618 if (numext::abs(coeff(i, j)) > threshold)
return false;
635 template <
typename MatrixType,
unsigned int Mode>
637 typedef typename storage_kind_to_evaluator_kind<typename MatrixType::StorageKind>::Kind Kind;
638 typedef typename glue_shapes<typename evaluator_traits<MatrixType>::Shape, TriangularShape>::type Shape;
641 template <
typename MatrixType,
unsigned int Mode>
642 struct unary_evaluator<TriangularView<MatrixType, Mode>, IndexBased> : evaluator<internal::remove_all_t<MatrixType>> {
643 typedef TriangularView<MatrixType, Mode> XprType;
644 typedef evaluator<internal::remove_all_t<MatrixType>> Base;
645 EIGEN_DEVICE_FUNC unary_evaluator(
const XprType& xpr) : Base(xpr.nestedExpression()) {}
649 struct Triangular2Triangular {};
650 struct Triangular2Dense {};
651 struct Dense2Triangular {};
653 template <
typename Kernel,
unsigned int Mode,
int UnrollCount,
bool ClearOpposite>
654 struct triangular_assignment_loop;
661 template <
int UpLo,
int Mode,
int SetOpposite,
typename DstEvaluatorTypeT,
typename SrcEvaluatorTypeT,
typename Functor,
662 int Version = Specialized>
663 class triangular_dense_assignment_kernel
664 :
public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version> {
666 typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version> Base;
667 typedef typename Base::DstXprType DstXprType;
668 typedef typename Base::SrcXprType SrcXprType;
670 using Base::m_functor;
674 typedef typename Base::DstEvaluatorType DstEvaluatorType;
675 typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
676 typedef typename Base::Scalar Scalar;
677 typedef typename Base::AssignmentTraits AssignmentTraits;
679 EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType& dst,
const SrcEvaluatorType& src,
680 const Functor& func, DstXprType& dstExpr)
681 : Base(dst, src, func, dstExpr) {}
683 #ifdef EIGEN_INTERNAL_DEBUGGING 684 EIGEN_DEVICE_FUNC
void assignCoeff(
Index row,
Index col) {
685 eigen_internal_assert(row != col);
686 Base::assignCoeff(row, col);
689 using Base::assignCoeff;
692 EIGEN_DEVICE_FUNC
void assignDiagonalCoeff(
Index id) {
693 if (Mode ==
UnitDiag && SetOpposite)
694 m_functor.assignCoeff(m_dst.coeffRef(
id,
id), Scalar(1));
695 else if (Mode ==
ZeroDiag && SetOpposite)
696 m_functor.assignCoeff(m_dst.coeffRef(
id,
id), Scalar(0));
698 Base::assignCoeff(
id,
id);
701 EIGEN_DEVICE_FUNC
void assignOppositeCoeff(
Index row,
Index col) {
702 eigen_internal_assert(row != col);
703 if (SetOpposite) m_functor.assignCoeff(m_dst.coeffRef(row, col), Scalar(0));
707 template <
int Mode,
bool SetOpposite,
typename DstXprType,
typename SrcXprType,
typename Functor>
708 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void call_triangular_assignment_loop(DstXprType& dst,
const SrcXprType& src,
709 const Functor& func) {
710 typedef evaluator<DstXprType> DstEvaluatorType;
711 typedef evaluator<SrcXprType> SrcEvaluatorType;
713 SrcEvaluatorType srcEvaluator(src);
715 Index dstRows = src.rows();
716 Index dstCols = src.cols();
717 if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols);
718 DstEvaluatorType dstEvaluator(dst);
721 SetOpposite, DstEvaluatorType, SrcEvaluatorType, Functor>
723 Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived());
726 unroll = DstXprType::SizeAtCompileTime !=
Dynamic && SrcEvaluatorType::CoeffReadCost <
HugeCost &&
727 DstXprType::SizeAtCompileTime *
728 (int(DstEvaluatorType::CoeffReadCost) + int(SrcEvaluatorType::CoeffReadCost)) / 2 <=
729 EIGEN_UNROLLING_LIMIT
732 triangular_assignment_loop<Kernel, Mode, unroll ? int(DstXprType::SizeAtCompileTime) : Dynamic, SetOpposite>::run(
736 template <
int Mode,
bool SetOpposite,
typename DstXprType,
typename SrcXprType>
737 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void call_triangular_assignment_loop(DstXprType& dst,
const SrcXprType& src) {
738 call_triangular_assignment_loop<Mode, SetOpposite>(
739 dst, src, internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>());
743 struct AssignmentKind<TriangularShape, TriangularShape> {
744 typedef Triangular2Triangular Kind;
747 struct AssignmentKind<DenseShape, TriangularShape> {
748 typedef Triangular2Dense Kind;
751 struct AssignmentKind<TriangularShape, DenseShape> {
752 typedef Dense2Triangular Kind;
755 template <
typename DstXprType,
typename SrcXprType,
typename Functor>
756 struct Assignment<DstXprType, SrcXprType, Functor, Triangular2Triangular> {
757 EIGEN_DEVICE_FUNC
static void run(DstXprType& dst,
const SrcXprType& src,
const Functor& func) {
758 eigen_assert(
int(DstXprType::Mode) ==
int(SrcXprType::Mode));
760 call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func);
764 template <
typename DstXprType,
typename SrcXprType,
typename Functor>
765 struct Assignment<DstXprType, SrcXprType, Functor, Triangular2Dense> {
766 EIGEN_DEVICE_FUNC
static void run(DstXprType& dst,
const SrcXprType& src,
const Functor& func) {
767 call_triangular_assignment_loop<SrcXprType::Mode, (int(SrcXprType::Mode) & int(SelfAdjoint)) == 0>(dst, src, func);
771 template <
typename DstXprType,
typename SrcXprType,
typename Functor>
772 struct Assignment<DstXprType, SrcXprType, Functor, Dense2Triangular> {
773 EIGEN_DEVICE_FUNC
static void run(DstXprType& dst,
const SrcXprType& src,
const Functor& func) {
774 call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func);
778 template <
typename Kernel,
unsigned int Mode,
int UnrollCount,
bool SetOpposite>
779 struct triangular_assignment_loop {
781 typedef typename Kernel::DstEvaluatorType DstEvaluatorType;
782 typedef typename DstEvaluatorType::XprType DstXprType;
785 col = (UnrollCount - 1) / DstXprType::RowsAtCompileTime,
786 row = (UnrollCount - 1) % DstXprType::RowsAtCompileTime
789 typedef typename Kernel::Scalar Scalar;
791 EIGEN_DEVICE_FUNC
static inline void run(Kernel& kernel) {
792 triangular_assignment_loop<Kernel, Mode, UnrollCount - 1, SetOpposite>::run(kernel);
795 kernel.assignDiagonalCoeff(row);
796 else if (((Mode &
Lower) && row > col) || ((Mode &
Upper) && row < col))
797 kernel.assignCoeff(row, col);
798 else if (SetOpposite)
799 kernel.assignOppositeCoeff(row, col);
804 template <
typename Kernel,
unsigned int Mode,
bool SetOpposite>
805 struct triangular_assignment_loop<Kernel, Mode, 0, SetOpposite> {
806 EIGEN_DEVICE_FUNC
static inline void run(Kernel&) {}
812 template <
typename Kernel,
unsigned int Mode,
bool SetOpposite>
813 struct triangular_assignment_loop<Kernel, Mode,
Dynamic, SetOpposite> {
814 typedef typename Kernel::Scalar Scalar;
815 EIGEN_DEVICE_FUNC
static inline void run(Kernel& kernel) {
816 for (
Index j = 0; j < kernel.cols(); ++j) {
817 Index maxi = numext::mini(j, kernel.rows());
819 if (((Mode &
Lower) && SetOpposite) || (Mode &
Upper)) {
820 for (; i < maxi; ++i)
822 kernel.assignCoeff(i, j);
824 kernel.assignOppositeCoeff(i, j);
828 if (i < kernel.rows())
829 kernel.assignDiagonalCoeff(i++);
831 if (((Mode &
Upper) && SetOpposite) || (Mode &
Lower)) {
832 for (; i < kernel.rows(); ++i)
834 kernel.assignCoeff(i, j);
836 kernel.assignOppositeCoeff(i, j);
846 template <
typename Derived>
847 template <
typename DenseDerived>
849 other.
derived().resize(this->rows(), this->cols());
850 internal::call_triangular_assignment_loop<Derived::Mode,
852 other.
derived(), derived().nestedExpression());
858 template <
typename DstXprType,
typename Lhs,
typename Rhs,
typename Scalar>
859 struct Assignment<DstXprType,
Product<Lhs, Rhs, DefaultProduct>,
860 internal::assign_op<Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>, Dense2Triangular> {
862 static void run(DstXprType& dst,
const SrcXprType& src,
863 const internal::assign_op<Scalar, typename SrcXprType::Scalar>&) {
864 Index dstRows = src.rows();
865 Index dstCols = src.cols();
866 if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols);
868 dst._assignProduct(src, Scalar(1),
false);
873 template <
typename DstXprType,
typename Lhs,
typename Rhs,
typename Scalar>
874 struct Assignment<DstXprType, Product<Lhs, Rhs, DefaultProduct>,
875 internal::add_assign_op<Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>,
877 typedef Product<Lhs, Rhs, DefaultProduct> SrcXprType;
878 static void run(DstXprType& dst,
const SrcXprType& src,
879 const internal::add_assign_op<Scalar, typename SrcXprType::Scalar>&) {
880 dst._assignProduct(src, Scalar(1),
true);
885 template <
typename DstXprType,
typename Lhs,
typename Rhs,
typename Scalar>
886 struct Assignment<DstXprType, Product<Lhs, Rhs, DefaultProduct>,
887 internal::sub_assign_op<Scalar, typename Product<Lhs, Rhs, DefaultProduct>::Scalar>,
889 typedef Product<Lhs, Rhs, DefaultProduct> SrcXprType;
890 static void run(DstXprType& dst,
const SrcXprType& src,
891 const internal::sub_assign_op<Scalar, typename SrcXprType::Scalar>&) {
892 dst._assignProduct(src, Scalar(-1),
true);
900 #endif // EIGEN_TRIANGULARMATRIX_H Index innerStride() const
Definition: TriangularMatrix.h:321
constexpr Derived & derived()
Definition: EigenBase.h:49
TransposeReturnType transpose(std::enable_if_t< Eigen::internal::is_lvalue< MatrixType >::value, Dummy *>=nullptr)
Definition: TriangularMatrix.h:229
TriangularViewType & setConstant(const Scalar &value)
Definition: TriangularMatrix.h:350
const ConjugateReturnType conjugate() const
Definition: TriangularMatrix.h:209
const int HugeCost
Definition: Constants.h:48
Expression of the product of two arbitrary matrices or vectors.
Definition: Product.h:198
const AdjointReturnType adjoint() const
Definition: TriangularMatrix.h:224
Definition: Constants.h:223
Base class for triangular part in a matrix.
Definition: TriangularMatrix.h:32
EIGEN_DEPRECATED void swap(MatrixBase< OtherDerived > const &other)
Definition: TriangularMatrix.h:473
const unsigned int DirectAccessBit
Definition: Constants.h:159
Scalar determinant() const
Definition: TriangularMatrix.h:274
const unsigned int LvalueBit
Definition: Constants.h:148
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
void fill(const Scalar &value)
Definition: TriangularMatrix.h:348
void swap(TriangularBase< OtherDerived > &other)
Definition: TriangularMatrix.h:460
const NestedExpression & nestedExpression() const
Definition: TriangularMatrix.h:202
const SelfAdjointView< MatrixTypeNestedNonRef, Mode > selfadjointView() const
Definition: TriangularMatrix.h:267
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:43
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:38
const unsigned int PacketAccessBit
Definition: Constants.h:97
TriangularViewType & operator-=(const DenseBase< Other > &other)
Definition: TriangularMatrix.h:332
Definition: EigenBase.h:33
NestedExpression & nestedExpression()
Definition: TriangularMatrix.h:205
TriangularViewType & setOnes()
Definition: TriangularMatrix.h:356
bool isUpperTriangular(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: TriangularMatrix.h:585
void copyCoeff(Index row, Index col, Other &other)
Definition: TriangularMatrix.h:79
Definition: Constants.h:211
const ConstTransposeReturnType transpose() const
Definition: TriangularMatrix.h:237
const Product< TriangularViewType, OtherDerived > operator*(const MatrixBase< OtherDerived > &rhs) const
Definition: TriangularMatrix.h:399
Scalar coeff(Index row, Index col) const
Definition: TriangularMatrix.h:361
Definition: Constants.h:215
friend const Product< OtherDerived, TriangularViewType > operator*(const MatrixBase< OtherDerived > &lhs, const TriangularViewImpl &rhs)
Definition: TriangularMatrix.h:406
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
SelfAdjointView< MatrixTypeNestedNonRef, Mode > selfadjointView()
Definition: TriangularMatrix.h:261
std::enable_if_t< std::is_base_of< DenseBase< std::decay_t< DerivedA > >, std::decay_t< DerivedA > >::value &&std::is_base_of< DenseBase< std::decay_t< DerivedB > >, std::decay_t< DerivedB > >::value, void > swap(DerivedA &&a, DerivedB &&b)
Definition: DenseBase.h:667
void evalTo(MatrixBase< DenseDerived > &other) const
Definition: TriangularMatrix.h:541
constexpr Index rows() const noexcept
Definition: TriangularMatrix.h:197
TriangularViewType & operator+=(const DenseBase< Other > &other)
Definition: TriangularMatrix.h:325
Expression of a selfadjoint matrix from a triangular part of a dense matrix.
Definition: SelfAdjointView.h:51
Definition: Constants.h:225
TriangularViewType & setZero()
Definition: TriangularMatrix.h:354
Definition: Constants.h:221
Definition: Constants.h:213
constexpr Derived & derived()
Definition: EigenBase.h:49
Definition: Constants.h:217
Definition: Constants.h:219
bool isLowerTriangular(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: TriangularMatrix.h:607
Definition: TriangularMatrix.h:41
Definition: Constants.h:227
Expression of a triangular part in a matrix.
Definition: TriangularMatrix.h:166
TriangularViewType & operator/=(const typename internal::traits< MatrixType >::Scalar &other)
Definition: TriangularMatrix.h:343
Definition: Constants.h:519
constexpr Index cols() const noexcept
Definition: TriangularMatrix.h:199
std::conditional_t< Cond, ConjugateReturnType, ConstTriangularView > conjugateIf() const
Definition: TriangularMatrix.h:217
const int Dynamic
Definition: Constants.h:25
Pseudo expression representing a solving operation.
Definition: Solve.h:62
TriangularViewType & operator*=(const typename internal::traits< MatrixType >::Scalar &other)
Definition: TriangularMatrix.h:339
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
const unsigned int LinearAccessBit
Definition: Constants.h:133
void evalToLazy(MatrixBase< DenseDerived > &other) const
Definition: TriangularMatrix.h:848
Scalar & coeffRef(Index row, Index col)
Definition: TriangularMatrix.h:369
Index outerStride() const
Definition: TriangularMatrix.h:318