11#ifndef EIGEN_SPARSEVIEW_H
12#define EIGEN_SPARSEVIEW_H
18template<
typename MatrixType>
19struct traits<SparseView<MatrixType> > : traits<MatrixType>
21 typedef typename MatrixType::Index Index;
22 typedef Sparse StorageKind;
24 Flags = int(traits<MatrixType>::Flags) & (
RowMajorBit)
44template<
typename MatrixType>
45class SparseView :
public SparseMatrixBase<SparseView<MatrixType> >
47 typedef typename MatrixType::Nested MatrixTypeNested;
48 typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
50 EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView)
52 explicit SparseView(
const MatrixType& mat,
const Scalar& reference = Scalar(0),
53 const RealScalar &epsilon = NumTraits<Scalar>::dummy_precision())
54 : 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 MatrixTypeNested m_matrix;
67 typename NumTraits<Scalar>::Real m_epsilon;
70template<
typename MatrixType>
73 typedef typename SparseView::Index Index;
75 typedef typename _MatrixTypeNested::InnerIterator IterBase;
77 IterBase(view.m_matrix, outer), m_view(view)
82 EIGEN_STRONG_INLINE InnerIterator& operator++()
84 IterBase::operator++();
89 using IterBase::value;
92 const SparseView& m_view;
95 void incrementToNonZero()
97 while((
bool(*
this)) && internal::isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon))
99 IterBase::operator++();
123template<
typename Derived>
125 const typename NumTraits<Scalar>::Real& m_epsilon)
const
Expression of a dense or sparse matrix with zero or too small values removed.
Definition SparseView.h:46
const SparseView< Derived > sparseView(const Scalar &m_reference=Scalar(0), const typename NumTraits< Scalar >::Real &m_epsilon=NumTraits< Scalar >::dummy_precision()) const
Definition SparseView.h:124
const unsigned int RowMajorBit
Definition Constants.h:53