|
MOAB
4.9.3pre
|
#include <CompressedStorage.h>

Stores a sparse set of values as a list of values and a list of indices.
Definition at line 22 of file CompressedStorage.h.
typedef NumTraits<Scalar>::Real Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::RealScalar [protected] |
Definition at line 31 of file CompressedStorage.h.
| typedef _Scalar Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::Scalar |
Definition at line 26 of file CompressedStorage.h.
| typedef _StorageIndex Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::StorageIndex |
Definition at line 27 of file CompressedStorage.h.
| Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::CompressedStorage | ( | ) | [inline] |
Definition at line 35 of file CompressedStorage.h.
: m_values(0), m_indices(0), m_size(0), m_allocatedSize(0) {}
| Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::CompressedStorage | ( | Index | size | ) | [inline, explicit] |
Definition at line 39 of file CompressedStorage.h.
| Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::CompressedStorage | ( | const CompressedStorage< _Scalar, _StorageIndex > & | other | ) | [inline] |
Definition at line 45 of file CompressedStorage.h.
: m_values(0), m_indices(0), m_size(0), m_allocatedSize(0) { *this = other; }
| Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::~CompressedStorage | ( | ) | [inline] |
Definition at line 70 of file CompressedStorage.h.
| Index Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::allocatedSize | ( | ) | const [inline] |
Definition at line 110 of file CompressedStorage.h.
{ return m_allocatedSize; }
| void Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::append | ( | const Scalar & | v, |
| Index | i | ||
| ) | [inline] |
| Scalar Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::at | ( | Index | key, |
| const Scalar & | defaultValue = Scalar(0) |
||
| ) | const [inline] |
Definition at line 146 of file CompressedStorage.h.
{
if (m_size==0)
return defaultValue;
else if (key==m_indices[m_size-1])
return m_values[m_size-1];
// ^^ optimization: let's first check if it is the last coefficient
// (very common in high level algorithms)
const Index id = searchLowerIndex(0,m_size-1,key);
return ((id<m_size) && (m_indices[id]==key)) ? m_values[id] : defaultValue;
}
| Scalar Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::atInRange | ( | Index | start, |
| Index | end, | ||
| Index | key, | ||
| const Scalar & | defaultValue = Scalar(0) |
||
| ) | const [inline] |
Like at(), but the search is performed in the range [start,end)
Definition at line 159 of file CompressedStorage.h.
{
if (start>=end)
return defaultValue;
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 Index id = searchLowerIndex(start,end-1,key);
return ((id<end) && (m_indices[id]==key)) ? m_values[id] : defaultValue;
}
| Scalar& Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::atWithInsertion | ( | Index | key, |
| const Scalar & | defaultValue = Scalar(0) |
||
| ) | [inline] |
Definition at line 174 of file CompressedStorage.h.
{
Index id = searchLowerIndex(0,m_size,key);
if (id>=m_size || m_indices[id]!=key)
{
if (m_allocatedSize<m_size+1)
{
m_allocatedSize = 2*(m_size+1);
internal::scoped_array<Scalar> newValues(m_allocatedSize);
internal::scoped_array<StorageIndex> newIndices(m_allocatedSize);
// copy first chunk
internal::smart_copy(m_values, m_values +id, newValues.ptr());
internal::smart_copy(m_indices, m_indices+id, newIndices.ptr());
// copy the rest
if(m_size>id)
{
internal::smart_copy(m_values +id, m_values +m_size, newValues.ptr() +id+1);
internal::smart_copy(m_indices+id, m_indices+m_size, newIndices.ptr()+id+1);
}
std::swap(m_values,newValues.ptr());
std::swap(m_indices,newIndices.ptr());
}
else if(m_size>id)
{
internal::smart_memmove(m_values +id, m_values +m_size, m_values +id+1);
internal::smart_memmove(m_indices+id, m_indices+m_size, m_indices+id+1);
}
m_size++;
m_indices[id] = internal::convert_index<StorageIndex>(key);
m_values[id] = defaultValue;
}
return m_values[id];
}
| void Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::clear | ( | ) | [inline] |
Definition at line 111 of file CompressedStorage.h.
{ m_size = 0; }
| StorageIndex& Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index | ( | Index | i | ) | [inline] |
Definition at line 121 of file CompressedStorage.h.
{ eigen_internal_assert(m_indices!=0); return m_indices[i]; }
| const StorageIndex& Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index | ( | Index | i | ) | const [inline] |
Definition at line 122 of file CompressedStorage.h.
{ eigen_internal_assert(m_indices!=0); return m_indices[i]; }
| const StorageIndex* Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::indexPtr | ( | ) | const [inline] |
Definition at line 115 of file CompressedStorage.h.
{ return m_indices; }
| StorageIndex* Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::indexPtr | ( | ) | [inline] |
Definition at line 116 of file CompressedStorage.h.
{ return m_indices; }
| CompressedStorage& Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::operator= | ( | const CompressedStorage< _Scalar, _StorageIndex > & | other | ) | [inline] |
Definition at line 51 of file CompressedStorage.h.
{
resize(other.size());
if(other.size()>0)
{
internal::smart_copy(other.m_values, other.m_values + m_size, m_values);
internal::smart_copy(other.m_indices, other.m_indices + m_size, m_indices);
}
return *this;
}
| void Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::prune | ( | const Scalar & | reference, |
| const RealScalar & | epsilon = NumTraits<RealScalar>::dummy_precision() |
||
| ) | [inline] |
| void Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::reallocate | ( | Index | size | ) | [inline, protected] |
Definition at line 228 of file CompressedStorage.h.
{
#ifdef EIGEN_SPARSE_COMPRESSED_STORAGE_REALLOCATE_PLUGIN
EIGEN_SPARSE_COMPRESSED_STORAGE_REALLOCATE_PLUGIN
#endif
eigen_internal_assert(size!=m_allocatedSize);
internal::scoped_array<Scalar> newValues(size);
internal::scoped_array<StorageIndex> newIndices(size);
Index copySize = (std::min)(size, m_size);
if (copySize>0) {
internal::smart_copy(m_values, m_values+copySize, newValues.ptr());
internal::smart_copy(m_indices, m_indices+copySize, newIndices.ptr());
}
std::swap(m_values,newValues.ptr());
std::swap(m_indices,newIndices.ptr());
m_allocatedSize = size;
}
| void Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::reserve | ( | Index | size | ) | [inline] |
Definition at line 76 of file CompressedStorage.h.
{
Index newAllocatedSize = m_size + size;
if (newAllocatedSize > m_allocatedSize)
reallocate(newAllocatedSize);
}
| void Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize | ( | Index | size, |
| double | reserveSizeFactor = 0 |
||
| ) | [inline] |
Definition at line 89 of file CompressedStorage.h.
{
if (m_allocatedSize<size)
{
Index realloc_size = (std::min<Index>)(NumTraits<StorageIndex>::highest(), size + Index(reserveSizeFactor*double(size)));
if(realloc_size<size)
internal::throw_std_bad_alloc();
reallocate(realloc_size);
}
m_size = size;
}
| Index Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::searchLowerIndex | ( | Index | key | ) | const [inline] |
k such that for all j in [0,k) index[j]<key Definition at line 125 of file CompressedStorage.h.
{
return searchLowerIndex(0, m_size, key);
}
| Index Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::searchLowerIndex | ( | Index | start, |
| Index | end, | ||
| Index | key | ||
| ) | const [inline] |
k in [start,end) such that for all j in [start,k) index[j]<key Definition at line 131 of file CompressedStorage.h.
| Index Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::size | ( | ) | const [inline] |
Definition at line 109 of file CompressedStorage.h.
{ return m_size; }
| void Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::squeeze | ( | ) | [inline] |
Definition at line 83 of file CompressedStorage.h.
{
if (m_allocatedSize>m_size)
reallocate(m_size);
}
| void Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::swap | ( | CompressedStorage< _Scalar, _StorageIndex > & | other | ) | [inline] |
Definition at line 62 of file CompressedStorage.h.
| Scalar& Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value | ( | Index | i | ) | [inline] |
Definition at line 118 of file CompressedStorage.h.
{ eigen_internal_assert(m_values!=0); return m_values[i]; }
| const Scalar& Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value | ( | Index | i | ) | const [inline] |
Definition at line 119 of file CompressedStorage.h.
{ eigen_internal_assert(m_values!=0); return m_values[i]; }
| const Scalar* Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::valuePtr | ( | ) | const [inline] |
Definition at line 113 of file CompressedStorage.h.
{ return m_values; }
| Scalar* Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::valuePtr | ( | ) | [inline] |
Definition at line 114 of file CompressedStorage.h.
{ return m_values; }
Index Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::m_allocatedSize [protected] |
Definition at line 250 of file CompressedStorage.h.
StorageIndex* Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::m_indices [protected] |
Definition at line 248 of file CompressedStorage.h.
Index Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::m_size [protected] |
Definition at line 249 of file CompressedStorage.h.
Scalar* Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::m_values [protected] |
Definition at line 247 of file CompressedStorage.h.