Logo Search packages:      
Sourcecode: eigen3 version File versions  Download package

template<typename _Scalar, typename _Index>
Scalar CompressedStorage< _Scalar, _Index >::atInRange ( size_t  start,
size_t  end,
Index  key,
Scalar  defaultValue = Scalar(0) 
) const [inline]

Like at(), but the search is performed in the range [start,end)

Definition at line 165 of file CompressedStorage.h.

    {
      if (start>=end)
        return Scalar(0);
      else if (end>start && key==m_indices[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 size_t id = searchLowerIndex(start,end-1,key);
      return ((id<end) && (m_indices[id]==key)) ? m_values[id] : defaultValue;
    }

Generated by  Doxygen 1.6.0   Back to index