11 #ifndef EIGEN_SPARSE_TRIANGULARVIEW_H
12 #define EIGEN_SPARSE_TRIANGULARVIEW_H
32 SkipLast = !SkipFirst,
34 HasUnitDiag = (Mode&
UnitDiag) ? 1 : 0
52 template<typename RhsType, typename DstType>
54 EIGEN_STRONG_INLINE
void _solve_impl(const RhsType &rhs, DstType &dst)
const {
57 this->solveInPlace(dst);
70 template<
typename ArgType,
unsigned int Mode>
71 struct unary_evaluator<
TriangularView<ArgType,Mode>, IteratorBased>
72 : evaluator_base<TriangularView<ArgType,Mode> >
78 typedef typename XprType::Scalar Scalar;
79 typedef typename XprType::StorageIndex StorageIndex;
80 typedef typename evaluator<ArgType>::InnerIterator
EvalIterator;
84 SkipLast = !SkipFirst,
86 HasUnitDiag = (Mode&
UnitDiag) ? 1 : 0
92 CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
93 Flags = XprType::Flags
96 explicit unary_evaluator(
const XprType &xpr) : m_argImpl(xpr.nestedExpression()), m_arg(xpr.nestedExpression()) {}
98 inline Index nonZerosEstimate()
const {
99 return m_argImpl.nonZerosEstimate();
107 EIGEN_STRONG_INLINE InnerIterator(
const unary_evaluator& xprEval,
Index outer)
108 : Base(xprEval.m_argImpl,outer), m_returnOne(false), m_containsDiag(Base::outer()<xprEval.m_arg.innerSize())
112 while((*
this) && ((HasUnitDiag||SkipDiag) ? this->index()<=outer : this->index()<outer))
115 m_returnOne = m_containsDiag;
117 else if(HasUnitDiag && ((!Base::operator
bool()) || Base::index()>=Base::outer()))
119 if((!SkipFirst) && Base::operator
bool())
121 m_returnOne = m_containsDiag;
125 EIGEN_STRONG_INLINE InnerIterator&
operator++()
127 if(HasUnitDiag && m_returnOne)
132 if(HasUnitDiag && (!SkipFirst) && ((!Base::operator
bool()) || Base::index()>=Base::outer()))
134 if((!SkipFirst) && Base::operator
bool())
136 m_returnOne = m_containsDiag;
142 EIGEN_STRONG_INLINE
operator bool()
const
144 if(HasUnitDiag && m_returnOne)
146 if(SkipFirst)
return Base::operator
bool();
149 if (SkipDiag)
return (Base::operator
bool() && this->index() < this->outer());
150 else return (Base::operator
bool() && this->index() <= this->outer());
156 inline StorageIndex index()
const
158 if(HasUnitDiag && m_returnOne)
return internal::convert_index<StorageIndex>(Base::outer());
159 else return Base::index();
161 inline Scalar value()
const
163 if(HasUnitDiag && m_returnOne)
return Scalar(1);
164 else return Base::value();
175 evaluator<ArgType> m_argImpl;
176 const ArgType& m_arg;
181 template<
typename Derived>
183 inline const TriangularView<const Derived, Mode>
#define EIGEN_DEVICE_FUNC
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
Base class for all dense matrices, vectors, and expressions.
The matrix class, also used for vectors and row-vectors.
Base class of any sparse matrices or sparse expressions.
const TriangularView< const Derived, Mode > triangularView() const
internal::remove_all_t< MatrixTypeNested > MatrixTypeNestedCleaned
TriangularView< MatrixType, Mode > TriangularViewType
MatrixType::Nested MatrixTypeNested
SparseMatrixBase< TriangularViewType > Base
void solveInPlace(MatrixBase< OtherDerived > &other) const
void solveInPlace(SparseMatrixBase< OtherDerived > &other) const
std::remove_reference_t< MatrixTypeNested > MatrixTypeNestedNonRef
Expression of a triangular part in a matrix.
const unsigned int RowMajorBit
bfloat16 operator++(bfloat16 &a)
typename remove_all< T >::type remove_all_t
EIGEN_ALWAYS_INLINE const T::Scalar * extract_data(const T &m)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.