11 #ifndef EIGEN_SPARSEVIEW_H 12 #define EIGEN_SPARSEVIEW_H 18 template<
typename MatrixType>
21 typedef typename MatrixType::StorageIndex StorageIndex;
30 template<
typename MatrixType>
33 typedef typename MatrixType::Nested MatrixTypeNested;
40 explicit SparseView(
const MatrixType& mat,
const Scalar& reference = Scalar(0),
42 : m_matrix(mat), m_reference(reference), m_epsilon(epsilon) {}
44 inline Index rows()
const {
return m_matrix.rows(); }
45 inline Index cols()
const {
return m_matrix.cols(); }
47 inline Index innerSize()
const {
return m_matrix.innerSize(); }
48 inline Index outerSize()
const {
return m_matrix.outerSize(); }
54 Scalar reference()
const {
return m_reference; }
55 RealScalar epsilon()
const {
return m_epsilon; }
58 MatrixTypeNested m_matrix;
69 template<
typename ArgType>
79 typedef typename XprType::Scalar Scalar;
83 : EvalIterator(sve.m_argImpl,outer), m_view(sve.m_view)
88 EIGEN_STRONG_INLINE InnerIterator& operator++()
90 EvalIterator::operator++();
95 using EvalIterator::value;
98 const XprType &m_view;
101 void incrementToNonZero()
103 while((
bool(*
this)) && internal::isMuchSmallerThan(value(), m_view.reference(), m_view.epsilon()))
105 EvalIterator::operator++();
112 Flags = XprType::Flags
119 const XprType &m_view;
122 template<
typename ArgType>
130 typedef typename XprType::Scalar Scalar;
131 typedef typename XprType::StorageIndex StorageIndex;
139 : m_sve(sve), m_inner(0), m_outer(outer), m_end(sve.m_view.innerSize())
141 incrementToNonZero();
144 EIGEN_STRONG_INLINE InnerIterator& operator++()
147 incrementToNonZero();
151 EIGEN_STRONG_INLINE Scalar value()
const 153 return (IsRowMajor) ? m_sve.m_argImpl.coeff(m_outer, m_inner)
154 : m_sve.m_argImpl.coeff(m_inner, m_outer);
157 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_inner; }
158 inline Index row()
const {
return IsRowMajor ? m_outer : index(); }
159 inline Index col()
const {
return IsRowMajor ? index() : m_outer; }
161 EIGEN_STRONG_INLINE
operator bool()
const {
return m_inner < m_end && m_inner>=0; }
170 void incrementToNonZero()
172 while((
bool(*
this)) && internal::isMuchSmallerThan(value(), m_sve.m_view.reference(), m_sve.m_view.epsilon()))
181 Flags = XprType::Flags
188 const XprType &m_view;
193 template<
typename Derived>
212 template<
typename Derived>
Definition: Constants.h:526
Definition: CoreEvaluators.h:90
Definition: CoreEvaluators.h:65
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
Holds information about the various numeric (i.e.
Definition: NumTraits.h:150
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:61
Definition: Constants.h:529
Definition: CoreEvaluators.h:109
const SparseView< Derived > pruned(const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const
Definition: SparseView.h:214
Base class of any sparse matrices or sparse expressions.
Definition: ForwardDeclarations.h:281
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: ForwardDeclarations.h:126
The type used to identify a general sparse storage.
Definition: Constants.h:494
Definition: BandTriangularSolver.h:13
NumTraits< Scalar >::Real RealScalar
This is the "real scalar" type; if the Scalar type is already real numbers (e.g.
Definition: SparseMatrixBase.h:119
const internal::remove_all< MatrixTypeNested >::type & nestedExpression() const
Definition: SparseView.h:52
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Definition: ForwardDeclarations.h:17
An InnerIterator allows to loop over the element of any matrix expression.
Definition: CoreIterators.h:33