11#ifndef EIGEN_SPARSEVIEW_H
12#define EIGEN_SPARSEVIEW_H
18template<
typename MatrixType>
21 typedef typename MatrixType::StorageIndex StorageIndex;
44template<
typename MatrixType>
47 typedef typename MatrixType::Nested MatrixTypeNested;
48 typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
52 typedef typename internal::remove_all<MatrixType>::type NestedExpression;
54 explicit SparseView(
const MatrixType&
mat,
const Scalar& reference = Scalar(0),
56 : m_matrix(
mat), m_reference(reference), m_epsilon(epsilon) {}
58 inline Index rows()
const {
return m_matrix.rows(); }
59 inline Index cols()
const {
return m_matrix.cols(); }
61 inline Index innerSize()
const {
return m_matrix.innerSize(); }
62 inline Index outerSize()
const {
return m_matrix.outerSize(); }
65 const typename internal::remove_all<MatrixTypeNested>::type&
68 Scalar reference()
const {
return m_reference; }
69 RealScalar epsilon()
const {
return m_epsilon; }
72 MatrixTypeNested m_matrix;
83template<
typename ArgType>
94 typedef typename XprType::Scalar Scalar;
98 : EvalIterator(
sve.m_argImpl,outer), m_view(
sve.m_view)
100 incrementToNonZero();
105 EvalIterator::operator++();
106 incrementToNonZero();
110 using EvalIterator::value;
116 void incrementToNonZero()
118 while((
bool(*
this)) && internal::isMuchSmallerThan(value(), m_view.reference(), m_view.epsilon()))
120 EvalIterator::operator++();
127 Flags = XprType::Flags
134 const XprType &m_view;
137template<
typename ArgType>
145 typedef typename XprType::Scalar Scalar;
146 typedef typename XprType::StorageIndex StorageIndex;
154 : m_sve(
sve), m_inner(0), m_outer(outer), m_end(
sve.m_view.
innerSize())
156 incrementToNonZero();
162 incrementToNonZero();
166 EIGEN_STRONG_INLINE Scalar value()
const
168 return (IsRowMajor) ? m_sve.m_argImpl.coeff(m_outer, m_inner)
169 : m_sve.m_argImpl.coeff(m_inner, m_outer);
172 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_inner; }
173 inline Index row()
const {
return IsRowMajor ? m_outer : index(); }
174 inline Index col()
const {
return IsRowMajor ? index() : m_outer; }
185 void incrementToNonZero()
187 while((
bool(*
this)) && internal::isMuchSmallerThan(value(), m_sve.m_view.reference(), m_sve.m_view.epsilon()))
196 Flags = XprType::Flags
203 const XprType &m_view;
225template<
typename Derived>
244template<
typename Derived>
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerSize() const
Definition DenseBase.h:235
An InnerIterator allows to loop over the element of any matrix expression.
Definition CoreIterators.h:34
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Base class of any sparse matrices or sparse expressions.
Definition SparseMatrixBase.h:28
NumTraits< Scalar >::Real RealScalar
This is the "real scalar" type; if the Scalar type is already real numbers (e.g.
Definition SparseMatrixBase.h:128
Expression of a dense or sparse matrix with zero or too small values removed.
Definition SparseView.h:46
const internal::remove_all< MatrixTypeNested >::type & nestedExpression() const
Definition SparseView.h:66
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Eigen::Index Index
The interface type of indices.
Definition EigenBase.h:39
Holds information about the various numeric (i.e.
Definition NumTraits.h:236
The type used to identify a general sparse storage.
Definition Constants.h:510
Definition Constants.h:542
Definition Constants.h:545
Definition CoreEvaluators.h:111
Definition CoreEvaluators.h:91
Definition ForwardDeclarations.h:17
Definition CoreEvaluators.h:65