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

template<typename _Scalar, typename _Index>
Scalar& CompressedStorage< _Scalar, _Index >::atWithInsertion ( Index  key,
Scalar  defaultValue = Scalar(0) 
) [inline]
Returns:
a reference to the value at index key If the value does not exist, then the value defaultValue is inserted such that the keys are sorted.

Definition at line 180 of file CompressedStorage.h.

Referenced by SparseVector< _Scalar, _Options, _Index >::coeffRef().

    {
      size_t id = searchLowerIndex(0,m_size,key);
      if (id>=m_size || m_indices[id]!=key)
      {
        resize(m_size+1,1);
        for (size_t j=m_size-1; j>id; --j)
        {
          m_indices[j] = m_indices[j-1];
          m_values[j] = m_values[j-1];
        }
        m_indices[id] = key;
        m_values[id] = defaultValue;
      }
      return m_values[id];
    }

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index