MOAB  4.9.3pre
Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator Class Reference

#include <AmbiVector.h>

Collaboration diagram for Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator:

List of all members.

Public Types

typedef _Scalar Scalar
typedef NumTraits< Scalar >::Real RealScalar

Public Member Functions

 Iterator (const AmbiVector &vec, const RealScalar &epsilon=0)
StorageIndex index () const
Scalar value () const
 operator bool () const
Iteratoroperator++ ()

Protected Attributes

const AmbiVectorm_vector
StorageIndex m_currentEl
RealScalar m_epsilon
StorageIndex m_cachedIndex
Scalar m_cachedValue
bool m_isDense

Detailed Description

template<typename _Scalar, typename _StorageIndex>
class Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator

Iterator over the nonzero coefficients

Definition at line 283 of file AmbiVector.h.


Member Typedef Documentation

template<typename _Scalar , typename _StorageIndex >
typedef NumTraits<Scalar>::Real Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::RealScalar

Definition at line 287 of file AmbiVector.h.

template<typename _Scalar , typename _StorageIndex >
typedef _Scalar Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::Scalar

Definition at line 286 of file AmbiVector.h.


Constructor & Destructor Documentation

template<typename _Scalar , typename _StorageIndex >
Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::Iterator ( const AmbiVector vec,
const RealScalar epsilon = 0 
) [inline, explicit]

Default constructor

Parameters:
vecthe vector on which we iterate
epsilonthe minimal value used to prune zero coefficients. In practice, all coefficients having a magnitude smaller than epsilon are skipped.

Definition at line 295 of file AmbiVector.h.

      : m_vector(vec)
    {
      using std::abs;
      m_epsilon = epsilon;
      m_isDense = m_vector.m_mode==IsDense;
      if (m_isDense)
      {
        m_currentEl = 0;   // this is to avoid a compilation warning
        m_cachedValue = 0; // this is to avoid a compilation warning
        m_cachedIndex = m_vector.m_start-1;
        ++(*this);
      }
      else
      {
        ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
        m_currentEl = m_vector.m_llStart;
        while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<=m_epsilon)
          m_currentEl = llElements[m_currentEl].next;
        if (m_currentEl<0)
        {
          m_cachedValue = 0; // this is to avoid a compilation warning
          m_cachedIndex = -1;
        }
        else
        {
          m_cachedIndex = llElements[m_currentEl].index;
          m_cachedValue = llElements[m_currentEl].value;
        }
      }
    }

Member Function Documentation

template<typename _Scalar , typename _StorageIndex >
StorageIndex Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::index ( ) const [inline]

Definition at line 327 of file AmbiVector.h.

{ return m_cachedIndex; }
template<typename _Scalar , typename _StorageIndex >
Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::operator bool ( ) const [inline]

Definition at line 330 of file AmbiVector.h.

{ return m_cachedIndex>=0; }
template<typename _Scalar , typename _StorageIndex >
Iterator& Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::operator++ ( ) [inline]

Definition at line 332 of file AmbiVector.h.

    {
      using std::abs;
      if (m_isDense)
      {
        do {
          ++m_cachedIndex;
        } while (m_cachedIndex<m_vector.m_end && abs(m_vector.m_buffer[m_cachedIndex])<m_epsilon);
        if (m_cachedIndex<m_vector.m_end)
          m_cachedValue = m_vector.m_buffer[m_cachedIndex];
        else
          m_cachedIndex=-1;
      }
      else
      {
        ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
        do {
          m_currentEl = llElements[m_currentEl].next;
        } while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<m_epsilon);
        if (m_currentEl<0)
        {
          m_cachedIndex = -1;
        }
        else
        {
          m_cachedIndex = llElements[m_currentEl].index;
          m_cachedValue = llElements[m_currentEl].value;
        }
      }
      return *this;
    }
template<typename _Scalar , typename _StorageIndex >
Scalar Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::value ( ) const [inline]

Definition at line 328 of file AmbiVector.h.

{ return m_cachedValue; }

Member Data Documentation

template<typename _Scalar , typename _StorageIndex >
StorageIndex Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::m_cachedIndex [protected]

Definition at line 368 of file AmbiVector.h.

template<typename _Scalar , typename _StorageIndex >
Scalar Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::m_cachedValue [protected]

Definition at line 369 of file AmbiVector.h.

template<typename _Scalar , typename _StorageIndex >
StorageIndex Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::m_currentEl [protected]

Definition at line 366 of file AmbiVector.h.

template<typename _Scalar , typename _StorageIndex >
RealScalar Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::m_epsilon [protected]

Definition at line 367 of file AmbiVector.h.

template<typename _Scalar , typename _StorageIndex >
bool Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::m_isDense [protected]

Definition at line 370 of file AmbiVector.h.

template<typename _Scalar , typename _StorageIndex >
const AmbiVector& Eigen::internal::AmbiVector< _Scalar, _StorageIndex >::Iterator::m_vector [protected]

Definition at line 365 of file AmbiVector.h.


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