11 #ifndef EIGEN_SPARSE_TRIANGULARVIEW_H 12 #define EIGEN_SPARSE_TRIANGULARVIEW_H 25 template<
typename MatrixType,
unsigned int Mode>
class TriangularViewImpl<MatrixType,Mode,
Sparse>
30 SkipLast = !SkipFirst,
32 HasUnitDiag = (Mode&
UnitDiag) ? 1 : 0
44 EIGEN_SPARSE_PUBLIC_INTERFACE(TriangularViewType)
46 typedef typename MatrixType::Nested MatrixTypeNested;
47 typedef typename internal::remove_reference<MatrixTypeNested>::type MatrixTypeNestedNonRef;
48 typedef typename internal::remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
50 template<
typename RhsType,
typename DstType>
52 EIGEN_STRONG_INLINE
void _solve_impl(
const RhsType &rhs, DstType &dst)
const {
53 if(!(internal::is_same<RhsType,DstType>::value && internal::extract_data(dst) == internal::extract_data(rhs)))
55 this->solveInPlace(dst);
68 template<
typename ArgType,
unsigned int Mode>
69 struct unary_evaluator<TriangularView<ArgType,Mode>, IteratorBased>
70 : evaluator_base<TriangularView<ArgType,Mode> >
76 typedef typename XprType::Scalar Scalar;
78 typedef typename evaluator<ArgType>::InnerIterator EvalIterator;
82 SkipLast = !SkipFirst,
84 HasUnitDiag = (Mode&
UnitDiag) ? 1 : 0
90 CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
91 Flags = XprType::Flags
94 explicit unary_evaluator(
const XprType &xpr) : m_argImpl(xpr.nestedExpression()), m_arg(xpr.nestedExpression()) {}
96 inline Index nonZerosEstimate()
const {
97 return m_argImpl.nonZerosEstimate();
100 class InnerIterator :
public EvalIterator
102 typedef EvalIterator
Base;
105 EIGEN_STRONG_INLINE InnerIterator(
const unary_evaluator& xprEval,
Index outer)
106 : Base(xprEval.m_argImpl,outer), m_returnOne(
false), m_containsDiag(Base::outer()<xprEval.m_arg.innerSize())
110 while((*
this) && ((HasUnitDiag||SkipDiag) ? this->index()<=outer : this->index()<outer))
113 m_returnOne = m_containsDiag;
115 else if(HasUnitDiag && ((!Base::operator
bool()) || Base::index()>=Base::outer()))
117 if((!SkipFirst) && Base::operator
bool())
119 m_returnOne = m_containsDiag;
123 EIGEN_STRONG_INLINE InnerIterator& operator++()
125 if(HasUnitDiag && m_returnOne)
130 if(HasUnitDiag && (!SkipFirst) && ((!Base::operator
bool()) || Base::index()>=Base::outer()))
132 if((!SkipFirst) && Base::operator
bool())
134 m_returnOne = m_containsDiag;
140 EIGEN_STRONG_INLINE
operator bool()
const 142 if(HasUnitDiag && m_returnOne)
144 if(SkipFirst)
return Base::operator bool();
147 if (SkipDiag)
return (Base::operator
bool() && this->index() < this->outer());
148 else return (Base::operator
bool() && this->index() <= this->outer());
154 inline StorageIndex index()
const 156 if(HasUnitDiag && m_returnOne)
return internal::convert_index<StorageIndex>(Base::outer());
157 else return Base::index();
159 inline Scalar value()
const 161 if(HasUnitDiag && m_returnOne)
return Scalar(1);
162 else return Base::value();
173 evaluator<ArgType> m_argImpl;
174 const ArgType& m_arg;
179 template<
typename Derived>
189 #endif // EIGEN_SPARSE_TRIANGULARVIEW_H Namespace containing all symbols from the Eigen library.
Definition: Core:141
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:39
const unsigned int RowMajorBit
Definition: Constants.h:66
internal::traits< TriangularView< MatrixType, Mode > >::StorageIndex StorageIndex
Definition: SparseMatrixBase.h:43
Base class of any sparse matrices or sparse expressions.
Definition: SparseMatrixBase.h:26
Definition: Constants.h:209
Definition: Constants.h:213
Definition: Constants.h:510
Definition: Constants.h:211
Definition: Constants.h:215
Definition: Eigen_Colamd.h:50
Expression of a triangular part in a matrix.
Definition: TriangularMatrix.h:187
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48