10 #ifndef EIGEN_MAPPED_SPARSEMATRIX_H    11 #define EIGEN_MAPPED_SPARSEMATRIX_H    25 template<
typename _Scalar, 
int _Flags, 
typename _Index>
    30 template<
typename _Scalar, 
int _Flags, 
typename _Index>
    36     enum { IsRowMajor = Base::IsRowMajor };
    49     inline Index 
rows()
 const { 
return IsRowMajor ? m_outerSize : m_innerSize; }
    50     inline Index 
cols()
 const { 
return IsRowMajor ? m_innerSize : m_outerSize; }
    51     inline Index 
innerSize()
 const { 
return m_innerSize; }
    52     inline Index 
outerSize()
 const { 
return m_outerSize; }
    68       const Index outer = IsRowMajor ? row : 
col;
    69       const Index inner = IsRowMajor ? col : 
row;
    71       Index start = m_outerIndex[outer];
    72       Index end = m_outerIndex[outer+1];
    75       else if (end>0 && inner==m_innerIndices[end-1])
    76         return m_values[end-1];
    80       const Index* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end-1],inner);
    81       const Index 
id = r-&m_innerIndices[0];
    82       return ((*r==inner) && (
id<end)) ? m_values[id] : 
Scalar(0);
    87       const Index outer = IsRowMajor ? row : 
col;
    88       const Index inner = IsRowMajor ? col : 
row;
    90       Index start = m_outerIndex[outer];
    91       Index end = m_outerIndex[outer+1];
    92       eigen_assert(end>=start && 
"you probably called coeffRef on a non finalized matrix");
    93       eigen_assert(end>start && 
"coeffRef cannot be called on a zero coefficient");
    94       Index* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end],inner);
    95       const Index 
id = r-&m_innerIndices[0];
    96       eigen_assert((*r==inner) && (
id<end) && 
"coeffRef cannot be called on a zero coefficient");
   101     class ReverseInnerIterator;
   107       : m_outerSize(IsRowMajor?rows:cols), m_innerSize(IsRowMajor?cols:rows), m_nnz(nnz), m_outerIndex(outerIndexPtr),
   108         m_innerIndices(innerIndexPtr), m_values(valuePtr)
   115 template<
typename Scalar, 
int _Flags, 
typename _Index>
   122         m_id(mat.outerIndexPtr()[outer]),
   124         m_end(mat.outerIndexPtr()[outer+1])
   132     inline Index index()
 const { 
return m_matrix.innerIndexPtr()[m_id]; }
   133     inline Index row()
 const { 
return IsRowMajor ? m_outer : index(); }
   134     inline Index col()
 const { 
return IsRowMajor ? index() : m_outer; }
   136     inline operator bool()
 const { 
return (m_id < m_end) && (m_id>=m_start); }
   146 template<
typename Scalar, 
int _Flags, 
typename _Index>
   153         m_id(mat.outerIndexPtr()[outer+1]),
   154         m_start(mat.outerIndexPtr()[outer]),
   160     inline Scalar value()
 const { 
return m_matrix.valuePtr()[m_id-1]; }
   163     inline Index 
index()
 const { 
return m_matrix.innerIndexPtr()[m_id-1]; }
   164     inline Index 
row()
 const { 
return IsRowMajor ? m_outer : index(); }
   165     inline Index 
col()
 const { 
return IsRowMajor ? index() : m_outer; }
   167     inline operator bool()
 const { 
return (m_id <= m_end) && (m_id>m_start); }
   179 #endif // EIGEN_MAPPED_SPARSEMATRIX_H 
ReverseInnerIterator(const MappedSparseMatrix &mat, Index outer)
const Scalar * valuePtr() const 
InnerIterator & operator++()
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
MappedSparseMatrix(Index rows, Index cols, Index nnz, Index *outerIndexPtr, Index *innerIndexPtr, Scalar *valuePtr)
Base class of any sparse matrices or sparse expressions. 
Scalar & coeffRef(Index row, Index col)
internal::traits< Derived >::Scalar Scalar
ReverseInnerIterator & operator--()
internal::traits< Derived >::Index Index
const Index * outerIndexPtr() const 
Scalar coeff(Index row, Index col) const 
An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression...
const MappedSparseMatrix & m_matrix
const MappedSparseMatrix & m_matrix
InnerIterator(const MappedSparseMatrix &mat, Index outer)
const Index * innerIndexPtr() const