10 #ifndef EIGEN_AMBIVECTOR_H 11 #define EIGEN_AMBIVECTOR_H 22 template<
typename _Scalar,
typename _StorageIndex>
36 void init(
double estimatedDensity);
66 return internal::convert_index<StorageIndex>(idx);
76 Index allocSize = (size *
sizeof(
ListEl) +
sizeof(Scalar) - 1)/
sizeof(Scalar);
95 allocSize = (allocSize +
sizeof(
Scalar) - 1)/
sizeof(
Scalar);
96 Scalar* newBuffer =
new Scalar[allocSize];
128 template<
typename _Scalar,
typename _StorageIndex>
137 template<
typename _Scalar,
typename _StorageIndex>
140 if (estimatedDensity>0.1)
146 template<
typename _Scalar,
typename _StorageIndex>
163 template<
typename _Scalar,
typename _StorageIndex>
170 template<
typename _Scalar,
typename _StorageIndex>
186 template<
typename _Scalar,
typename _StorageIndex>
202 llElements[0].value =
Scalar(0);
204 llElements[0].next = -1;
205 return llElements[0].value;
222 eigen_assert(i>=llElements[
m_llCurrent].index &&
"you must call restart() before inserting an element with lower or equal index");
223 while (nextel >= 0 && llElements[nextel].index<=i)
226 nextel = llElements[nextel].next;
255 template<
typename _Scalar,
typename _StorageIndex>
271 while (elid >= 0 && llElements[elid].index<i)
272 elid = llElements[elid].next;
274 if (llElements[elid].index==i)
283 template<
typename _Scalar,
typename _StorageIndex>
301 m_isDense = m_vector.m_mode==
IsDense;
306 m_cachedIndex = m_vector.m_start-1;
312 m_currentEl = m_vector.m_llStart;
313 while (m_currentEl>=0 &&
abs(llElements[m_currentEl].
value)<=m_epsilon)
314 m_currentEl = llElements[m_currentEl].
next;
322 m_cachedIndex = llElements[m_currentEl].index;
323 m_cachedValue = llElements[m_currentEl].value;
329 Scalar
value()
const {
return m_cachedValue; }
331 operator bool()
const {
return m_cachedIndex>=0; }
340 }
while (m_cachedIndex<m_vector.m_end &&
abs(m_vector.m_buffer[m_cachedIndex])<=m_epsilon);
341 if (m_cachedIndex<m_vector.m_end)
342 m_cachedValue = m_vector.m_buffer[m_cachedIndex];
350 m_currentEl = llElements[m_currentEl].
next;
351 }
while (m_currentEl>=0 &&
abs(llElements[m_currentEl].
value)<=m_epsilon);
358 m_cachedIndex = llElements[m_currentEl].index;
359 m_cachedValue = llElements[m_currentEl].value;
378 #endif // EIGEN_AMBIVECTOR_H
NumTraits< Scalar >::Real RealScalar
Iterator(const AmbiVector &vec, const RealScalar &epsilon=0)
Namespace containing all symbols from the Eigen library.
void setBounds(Index start, Index end)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
void init(double estimatedDensity)
StorageIndex index() const
void reallocate(Index size)
StorageIndex convert_index(Index idx)
Scalar & coeffRef(Index i)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
StorageIndex size() const
StorageIndex m_allocatedSize
StorageIndex m_allocatedElements
static EIGEN_DEPRECATED const end_t end
NumTraits< Scalar >::Real RealScalar
static const DiscreteKey mode(modeKey, 2)
#define eigen_internal_assert(x)
StorageIndex m_cachedIndex
const AmbiVector & m_vector
_StorageIndex StorageIndex