MOAB  4.9.3pre
Eigen::SparseMapBase< Derived, ReadOnlyAccessors > Class Template Reference

Common base class for Map and Ref instance of sparse matrix and vector. More...

#include <SparseMap.h>

Inheritance diagram for Eigen::SparseMapBase< Derived, ReadOnlyAccessors >:
Collaboration diagram for Eigen::SparseMapBase< Derived, ReadOnlyAccessors >:

List of all members.

Public Types

enum  { IsRowMajor = Base::IsRowMajor }
typedef SparseCompressedBase
< Derived > 
Base
typedef Base::Scalar Scalar
typedef Base::StorageIndex StorageIndex

Public Member Functions

Index rows () const
Index cols () const
Index innerSize () const
Index outerSize () const
Index nonZeros () const
bool isCompressed () const
const ScalarvaluePtr () const
const StorageIndexinnerIndexPtr () const
const StorageIndexouterIndexPtr () const
const StorageIndexinnerNonZeroPtr () const
Scalar coeff (Index row, Index col) const
 SparseMapBase (Index rows, Index cols, Index nnz, IndexPointer outerIndexPtr, IndexPointer innerIndexPtr, ScalarPointer valuePtr, IndexPointer innerNonZerosPtr=0)
 SparseMapBase (Index size, Index nnz, IndexPointer innerIndexPtr, ScalarPointer valuePtr)
 ~SparseMapBase ()

Protected Types

typedef internal::conditional
< bool(internal::is_lvalue
< Derived >::value), Scalar
*, const Scalar * >::type 
ScalarPointer
typedef internal::conditional
< bool(internal::is_lvalue
< Derived >::value),
StorageIndex *, const
StorageIndex * >::type 
IndexPointer

Protected Member Functions

 SparseMapBase ()

Protected Attributes

Index m_outerSize
Index m_innerSize
Array< StorageIndex, 2, 1 > m_zero_nnz
IndexPointer m_outerIndex
IndexPointer m_innerIndices
ScalarPointer m_values
IndexPointer m_innerNonZeros

Detailed Description

template<typename Derived>
class Eigen::SparseMapBase< Derived, ReadOnlyAccessors >

Common base class for Map and Ref instance of sparse matrix and vector.

class SparseMapBase

Definition at line 50 of file SparseMap.h.


Member Typedef Documentation

template<typename Derived >
typedef SparseCompressedBase<Derived> Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::Base

Reimplemented from Eigen::SparseCompressedBase< Derived >.

Reimplemented in Eigen::SparseMapBase< Derived, WriteAccessors >.

Definition at line 54 of file SparseMap.h.

template<typename Derived >
typedef internal::conditional< bool(internal::is_lvalue<Derived>::value), StorageIndex *, const StorageIndex *>::type Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::IndexPointer [protected]

Definition at line 66 of file SparseMap.h.

template<typename Derived >
typedef Base::Scalar Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::Scalar

Reimplemented from Eigen::SparseMatrixBase< Derived >.

Reimplemented in Eigen::SparseMapBase< Derived, WriteAccessors >.

Definition at line 55 of file SparseMap.h.

template<typename Derived >
typedef internal::conditional< bool(internal::is_lvalue<Derived>::value), Scalar *, const Scalar *>::type Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::ScalarPointer [protected]

Definition at line 63 of file SparseMap.h.

template<typename Derived >
typedef Base::StorageIndex Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::StorageIndex

Reimplemented from Eigen::SparseMatrixBase< Derived >.

Reimplemented in Eigen::SparseMapBase< Derived, WriteAccessors >.

Definition at line 56 of file SparseMap.h.


Member Enumeration Documentation

template<typename Derived >
anonymous enum
Enumerator:
IsRowMajor 

Definition at line 57 of file SparseMap.h.

{ IsRowMajor = Base::IsRowMajor };

Constructor & Destructor Documentation

template<typename Derived >
Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::SparseMapBase ( Index  rows,
Index  cols,
Index  nnz,
IndexPointer  outerIndexPtr,
IndexPointer  innerIndexPtr,
ScalarPointer  valuePtr,
IndexPointer  innerNonZerosPtr = 0 
) [inline]

Definition at line 124 of file SparseMap.h.

template<typename Derived >
Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::SparseMapBase ( Index  size,
Index  nnz,
IndexPointer  innerIndexPtr,
ScalarPointer  valuePtr 
) [inline]

Definition at line 131 of file SparseMap.h.

      : m_outerSize(1), m_innerSize(size), m_zero_nnz(0,internal::convert_index<StorageIndex>(nnz)), m_outerIndex(m_zero_nnz.data()),
        m_innerIndices(innerIndexPtr), m_values(valuePtr), m_innerNonZeros(0)
    {}
template<typename Derived >
Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::~SparseMapBase ( ) [inline]

Empty destructor

Reimplemented in Eigen::SparseMapBase< Derived, WriteAccessors >.

Definition at line 137 of file SparseMap.h.

{}
template<typename Derived >
Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::SparseMapBase ( ) [inline, protected]

Reimplemented in Eigen::SparseMapBase< Derived, WriteAccessors >.

Definition at line 140 of file SparseMap.h.

{}

Member Function Documentation

template<typename Derived >
Scalar Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::coeff ( Index  row,
Index  col 
) const [inline]
Returns:
the value of the matrix at position i, j This function returns Scalar(0) if the element is an explicit zero

Definition at line 105 of file SparseMap.h.

    {
      const Index outer = IsRowMajor ? row : col;
      const Index inner = IsRowMajor ? col : row;

      Index start = m_outerIndex[outer];
      Index end = isCompressed() ? m_outerIndex[outer+1] : start + m_innerNonZeros[outer];
      if (start==end)
        return Scalar(0);
      else if (end>0 && inner==m_innerIndices[end-1])
        return m_values[end-1];
      // ^^  optimization: let's first check if it is the last coefficient
      // (very common in high level algorithms)

      const StorageIndex* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end-1],inner);
      const Index id = r-&m_innerIndices[0];
      return ((*r==inner) && (id<end)) ? m_values[id] : Scalar(0);
    }
template<typename Derived >
Index Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::cols ( void  ) const [inline]
Returns:
the number of columns.
See also:
rows()

Reimplemented from Eigen::SparseMatrixBase< Derived >.

Definition at line 81 of file SparseMap.h.

template<typename Derived >
const StorageIndex* Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::innerIndexPtr ( ) const [inline]
Returns:
a const pointer to the array of inner indices. This function is aimed at interoperability with other libraries.
See also:
valuePtr(), outerIndexPtr()

Reimplemented from Eigen::SparseCompressedBase< Derived >.

Definition at line 97 of file SparseMap.h.

{ return m_innerIndices; }
template<typename Derived >
const StorageIndex* Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::innerNonZeroPtr ( ) const [inline]
Returns:
a const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries.
Warning:
it returns the null pointer 0 in compressed mode

Reimplemented from Eigen::SparseCompressedBase< Derived >.

Definition at line 101 of file SparseMap.h.

{ return m_innerNonZeros; }
template<typename Derived >
Index Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::innerSize ( ) const [inline]
Returns:
the size of the inner dimension according to the storage order, i.e., the number of rows for a columns major matrix, and the number of cols otherwise

Reimplemented from Eigen::SparseMatrixBase< Derived >.

Definition at line 83 of file SparseMap.h.

{ return m_innerSize; }
template<typename Derived >
bool Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::isCompressed ( ) const [inline]
Returns:
whether *this is in compressed form.

Reimplemented from Eigen::SparseCompressedBase< Derived >.

Definition at line 90 of file SparseMap.h.

{ return m_innerNonZeros==0; }
template<typename Derived >
Index Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::nonZeros ( ) const [inline]
Returns:
the number of non zero coefficients

Reimplemented from Eigen::SparseCompressedBase< Derived >.

Definition at line 87 of file SparseMap.h.

{ return m_zero_nnz[1]; }
template<typename Derived >
const StorageIndex* Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::outerIndexPtr ( ) const [inline]
Returns:
a const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries.
See also:
valuePtr(), innerIndexPtr()

Reimplemented from Eigen::SparseCompressedBase< Derived >.

Definition at line 99 of file SparseMap.h.

{ return m_outerIndex; }
template<typename Derived >
Index Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::outerSize ( ) const [inline]
Returns:
the size of the storage major dimension, i.e., the number of columns for a columns major matrix, and the number of rows otherwise

Reimplemented from Eigen::SparseMatrixBase< Derived >.

Definition at line 85 of file SparseMap.h.

{ return m_outerSize; }
template<typename Derived >
Index Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::rows ( void  ) const [inline]
Returns:
the number of rows.
See also:
cols()

Reimplemented from Eigen::SparseMatrixBase< Derived >.

Definition at line 79 of file SparseMap.h.

template<typename Derived >
const Scalar* Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::valuePtr ( ) const [inline]
Returns:
a const pointer to the array of values. This function is aimed at interoperability with other libraries.
See also:
innerIndexPtr(), outerIndexPtr()

Reimplemented from Eigen::SparseCompressedBase< Derived >.

Definition at line 95 of file SparseMap.h.

{ return m_values; }

Member Data Documentation

template<typename Derived >
IndexPointer Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::m_innerIndices [protected]

Definition at line 72 of file SparseMap.h.

template<typename Derived >
IndexPointer Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::m_innerNonZeros [protected]

Definition at line 74 of file SparseMap.h.

template<typename Derived >
Index Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::m_innerSize [protected]

Definition at line 69 of file SparseMap.h.

template<typename Derived >
IndexPointer Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::m_outerIndex [protected]

Definition at line 71 of file SparseMap.h.

template<typename Derived >
Index Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::m_outerSize [protected]

Definition at line 68 of file SparseMap.h.

template<typename Derived >
ScalarPointer Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::m_values [protected]

Definition at line 73 of file SparseMap.h.

template<typename Derived >
Array<StorageIndex,2,1> Eigen::SparseMapBase< Derived, ReadOnlyAccessors >::m_zero_nnz [protected]

Definition at line 70 of file SparseMap.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines