10 #ifndef EIGEN_SPARSE_COMPRESSED_BASE_H    11 #define EIGEN_SPARSE_COMPRESSED_BASE_H    19 template<
typename Derived>
    35 template<
typename Derived>
    42     using Base::operator=;
    43     using Base::IsRowMajor;
    46     class ReverseInnerIterator;
    58       if(Derived::IsVectorAtCompileTime && outerIndexPtr()==0)
    59         return derived().nonZeros();
    60       else if(isCompressed())
    61         return outerIndexPtr()[derived().outerSize()]-outerIndexPtr()[0];
    62       else if(derived().outerSize()==0)
    65         return innerNonZeros().sum();
   135 template<
typename Derived>
   140       : m_values(0), m_indices(0), m_outer(0), m_id(0), m_end(0)
   144       : m_values(other.m_values), m_indices(other.m_indices), m_outer(other.m_outer), m_id(other.m_id), m_end(other.m_end)
   158       : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(outer)
   176       : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(0), m_id(0), m_end(mat.nonZeros())
   182       : m_values(data.valuePtr()), m_indices(data.indexPtr()), m_outer(0), m_id(0), m_end(data.size())
   194     inline Index row()
 const { 
return IsRowMajor ? m_outer.value() : index(); }
   195     inline Index col()
 const { 
return IsRowMajor ? index() : m_outer.value(); }
   197     inline operator bool()
 const { 
return (m_id < m_end); }
   213 template<
typename Derived>
   218       : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(outer)
   236       : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(0), m_start(0), m_id(mat.nonZeros())
   242       : m_values(data.valuePtr()), m_indices(data.indexPtr()), m_outer(0), m_start(0), m_id(data.size())
   254     inline Index row()
 const { 
return IsRowMajor ? m_outer.value() : index(); }
   255     inline Index col()
 const { 
return IsRowMajor ? index() : m_outer.value(); }
   257     inline operator bool()
 const { 
return (m_id > m_start); }
   270 template<
typename Derived>
   279     Flags = Derived::Flags
   292     return m_matrix->nonZeros();
   295   operator Derived&() { 
return m_matrix->const_cast_derived(); }
   296   operator const Derived&() 
const { 
return *m_matrix; }
   300   { 
return m_matrix->coeff(row,col); }
   306     const Index outer = Derived::IsRowMajor ? 
row : 
col;
   307     const Index inner = Derived::IsRowMajor ? 
col : 
row;
   309     Index start = m_matrix->outerIndexPtr()[outer];
   310     Index end = m_matrix->isCompressed() ? m_matrix->outerIndexPtr()[outer+1] : m_matrix->outerIndexPtr()[outer] + m_matrix->innerNonZeroPtr()[outer];
   311     eigen_assert(end>start && 
"you are using a non finalized sparse matrix or written coefficient does not exist");
   312     const Index p =   std::lower_bound(m_matrix->innerIndexPtr()+start, m_matrix->innerIndexPtr()+end,inner)
   313                     - m_matrix->innerIndexPtr();
   314     eigen_assert((p<end) && (m_matrix->innerIndexPtr()[p]==inner) && 
"written coefficient does not exist");
   315     return m_matrix->const_cast_derived().valuePtr()[p];
   325 #endif // EIGEN_SPARSE_COMPRESSED_BASE_H ReverseInnerIterator(const internal::CompressedStorage< Scalar, StorageIndex > &data)
bool isCompressed() const
const Eigen::Map< const IndexVector > innerNonZeros() const
SparseMatrixBase< Derived > Base
A matrix or vector expression mapping an existing array of data. 
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col(). */. 
evaluator(const Derived &mat)
InnerIterator(const InnerIterator &other)
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T value()
StorageIndex * innerIndexPtr()
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
InnerIterator & operator++()
Eigen::Index Index
The interface type of indices. 
const StorageIndex * innerNonZeroPtr() const
Eigen::Map< IndexVector > innerNonZeros()
Map< Array< Scalar, Dynamic, 1 > > coeffs()
internal::traits< Block< const SparseMatrix< _Scalar, _Options, _StorageIndex >, BlockRows, BlockCols, true > >::StorageIndex StorageIndex
const StorageIndex * m_indices
#define EIGEN_INTERNAL_CHECK_COST_VALUE(C)
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
Base class of any sparse matrices or sparse expressions. 
Derived::InnerIterator InnerIterator
StorageIndex index() const
StorageIndex * innerNonZeroPtr()
internal::traits< Block< const SparseMatrix< _Scalar, _Options, _StorageIndex >, BlockRows, BlockCols, true > >::Scalar Scalar
internal::variable_if_dynamic< Index, Derived::IsVectorAtCompileTime?0:Dynamic > OuterType
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API. 
InnerIterator(const internal::CompressedStorage< Scalar, StorageIndex > &data)
InnerIterator(const SparseCompressedBase &mat, Index outer)
const Scalar & value() const
const StorageIndex * innerIndexPtr() const
Base::IndexVector IndexVector
internal::variable_if_dynamic< Index, Derived::IsVectorAtCompileTime?0:Dynamic > OuterType
ReverseInnerIterator(const SparseCompressedBase &mat)
DenseCoeffsBase< Derived, ReadOnlyAccessors >::CoeffReturnType CoeffReturnType
const StorageIndex * outerIndexPtr() const
InnerIterator & operator=(const InnerIterator &other)
StorageIndex * outerIndexPtr()
Index nonZerosEstimate() const
const StorageIndex * m_indices
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). */. 
static ConstMapType Map(const Scalar *data)
const Scalar & value() const
ReverseInnerIterator(const SparseCompressedBase &mat, Index outer)
ReverseInnerIterator & operator--()
#define eigen_internal_assert(x)
Scalar coeff(Index row, Index col) const
Common base class for sparse [compressed]-{row|column}-storage format. 
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
const Scalar * valuePtr() const
StorageIndex index() const
InnerIterator(const SparseCompressedBase &mat)
const Map< const Array< Scalar, Dynamic, 1 > > coeffs() const
An InnerIterator allows to loop over the element of any matrix expression. 
struct thread_data * data
Scalar & coeffRef(Index row, Index col)