11#ifndef EIGEN_SPARSE_TRIANGULARVIEW_H
12#define EIGEN_SPARSE_TRIANGULARVIEW_H
30 SkipLast = !SkipFirst,
32 HasUnitDiag = (Mode&
UnitDiag) ? 1 : 0
47 class ReverseInnerIterator;
49 typedef typename MatrixType::Nested MatrixTypeNested;
50 typedef typename internal::remove_reference<MatrixTypeNested>::type MatrixTypeNestedNonRef;
53 template<
typename RhsType,
typename DstType>
58 this->solveInPlace(
dst);
66template<
typename MatrixType,
unsigned int Mode>
69 typedef typename MatrixTypeNestedCleaned::InnerIterator Base;
73 : Base(view.derived().nestedExpression(), outer), m_returnOne(
false)
77 while((*
this) && ((HasUnitDiag||SkipDiag) ? this->index()<=outer : this->index()<outer))
82 else if(HasUnitDiag && ((!Base::operator
bool()) || Base::index()>=Base::outer()))
84 if((!SkipFirst) && Base::operator
bool())
92 if(HasUnitDiag && m_returnOne)
97 if(HasUnitDiag && (!SkipFirst) && ((!Base::operator
bool()) || Base::index()>=Base::outer()))
99 if((!SkipFirst) && Base::operator
bool())
107 inline Index row()
const {
return (MatrixType::Flags&
RowMajorBit ? Base::outer() : this->index()); }
108 inline Index col()
const {
return (MatrixType::Flags&
RowMajorBit ? this->index() : Base::outer()); }
109 inline StorageIndex index()
const
111 if(HasUnitDiag && m_returnOne)
return Base::outer();
112 else return Base::index();
114 inline Scalar value()
const
116 if(HasUnitDiag && m_returnOne)
return Scalar(1);
117 else return Base::value();
120 EIGEN_STRONG_INLINE
operator bool()
const
122 if(HasUnitDiag && m_returnOne)
124 if(SkipFirst)
return Base::operator bool();
127 if (SkipDiag)
return (Base::operator
bool() && this->index() < this->outer());
128 else return (Base::operator
bool() && this->index() <= this->outer());
135template<
typename MatrixType,
unsigned int Mode>
138 typedef typename MatrixTypeNestedCleaned::ReverseInnerIterator Base;
142 : Base(view.derived().nestedExpression(), outer)
144 eigen_assert((!HasUnitDiag) &&
"ReverseInnerIterator does not support yet triangular views with a unit diagonal");
146 while((*
this) && (SkipDiag ? this->index()>=outer : this->index()>outer))
151 EIGEN_STRONG_INLINE ReverseInnerIterator& operator--()
152 { Base::operator--();
return *
this; }
154 inline Index row()
const {
return Base::row(); }
155 inline Index col()
const {
return Base::col(); }
157 EIGEN_STRONG_INLINE
operator bool()
const
159 if (SkipLast)
return Base::operator bool() ;
162 if(SkipDiag)
return (Base::operator
bool() && this->index() > this->outer());
163 else return (Base::operator
bool() && this->index() >= this->outer());
170template<
typename ArgType,
unsigned int Mode>
178 typedef typename XprType::Scalar Scalar;
179 typedef typename XprType::StorageIndex StorageIndex;
184 SkipLast = !SkipFirst,
186 HasUnitDiag = (Mode&
UnitDiag) ? 1 : 0
193 Flags = XprType::Flags
198 inline Index nonZerosEstimate()
const {
199 return m_argImpl.nonZerosEstimate();
204 typedef EvalIterator
Base;
208 :
Base(
xprEval.m_argImpl,outer), m_returnOne(
false)
212 while((*
this) && ((HasUnitDiag||SkipDiag) ? this->index()<=outer : this->index()<outer))
217 else if(HasUnitDiag && ((!Base::operator
bool()) || Base::index()>=Base::outer()))
219 if((!SkipFirst) && Base::operator
bool())
227 if(HasUnitDiag && m_returnOne)
232 if(HasUnitDiag && (!SkipFirst) && ((!Base::operator
bool()) || Base::index()>=Base::outer()))
234 if((!SkipFirst) && Base::operator
bool())
242 EIGEN_STRONG_INLINE
operator bool()
const
244 if(HasUnitDiag && m_returnOne)
246 if(SkipFirst)
return Base::operator bool();
249 if (SkipDiag)
return (Base::operator
bool() && this->index() < this->outer());
250 else return (Base::operator
bool() && this->index() <= this->outer());
256 inline StorageIndex index()
const
258 if(HasUnitDiag && m_returnOne)
return internal::convert_index<StorageIndex>(Base::outer());
259 else return Base::index();
261 inline Scalar value()
const
263 if(HasUnitDiag && m_returnOne)
return Scalar(1);
264 else return Base::value();
279template<
typename Derived>
An InnerIterator allows to loop over the element of any matrix expression.
Definition CoreIterators.h:34
Pseudo expression representing a solving operation.
Definition Solve.h:63
Base class of any sparse matrices or sparse expressions.
Definition SparseMatrixBase.h:34
Definition TriangularMatrix.h:184
Expression of a triangular part in a matrix.
Definition TriangularMatrix.h:188
@ UnitDiag
Matrix has ones on the diagonal; to be used in combination with #Lower or #Upper.
Definition Constants.h:208
@ ZeroDiag
Matrix has zeros on the diagonal; to be used in combination with #Lower or #Upper.
Definition Constants.h:210
@ Lower
View matrix as a lower triangular matrix.
Definition Constants.h:204
@ Upper
View matrix as an upper triangular matrix.
Definition Constants.h:206
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:61
The type used to identify a general sparse storage.
Definition Constants.h:493
Definition Constants.h:528
Definition CoreEvaluators.h:101
Definition CoreEvaluators.h:82
Definition CoreEvaluators.h:56