10 #ifndef EIGEN_AMBIVECTOR_H 11 #define EIGEN_AMBIVECTOR_H 22 template<
typename _Scalar,
typename _Index>
36 void init(
double estimatedDensity);
48 Scalar&
coeff(Index i);
72 Index allocSize = (size *
sizeof(
ListEl))/
sizeof(
Scalar);
91 allocSize = allocSize/
sizeof(
Scalar) + (allocSize%
sizeof(Scalar)>0?1:0);
92 Scalar* newBuffer =
new Scalar[allocSize];
124 template<
typename _Scalar,
typename _Index>
133 template<
typename _Scalar,
typename _Index>
136 if (estimatedDensity>0.1)
142 template<
typename _Scalar,
typename _Index>
158 template<
typename _Scalar,
typename _Index>
165 template<
typename _Scalar,
typename _Index>
181 template<
typename _Scalar,
typename _Index>
197 llElements[0].value =
Scalar(0);
198 llElements[0].index = i;
199 llElements[0].next = -1;
200 return llElements[0].value;
217 eigen_assert(i>=llElements[
m_llCurrent].index &&
"you must call restart() before inserting an element with lower or equal index");
218 while (nextel >= 0 && llElements[nextel].index<=i)
221 nextel = llElements[nextel].next;
250 template<
typename _Scalar,
typename _Index>
266 while (elid >= 0 && llElements[elid].index<i)
267 elid = llElements[elid].next;
269 if (llElements[elid].index==i)
278 template<
typename _Scalar,
typename _Index>
296 m_isDense = m_vector.m_mode==
IsDense;
301 m_cachedIndex = m_vector.m_start-1;
307 m_currentEl = m_vector.m_llStart;
308 while (m_currentEl>=0 &&
abs(llElements[m_currentEl].
value)<=m_epsilon)
309 m_currentEl = llElements[m_currentEl].
next;
317 m_cachedIndex = llElements[m_currentEl].index;
318 m_cachedValue = llElements[m_currentEl].value;
324 Scalar
value()
const {
return m_cachedValue; }
326 operator bool()
const {
return m_cachedIndex>=0; }
335 }
while (m_cachedIndex<m_vector.m_end &&
abs(m_vector.m_buffer[m_cachedIndex])<m_epsilon);
336 if (m_cachedIndex<m_vector.m_end)
337 m_cachedValue = m_vector.m_buffer[m_cachedIndex];
345 m_currentEl = llElements[m_currentEl].
next;
346 }
while (m_currentEl>=0 &&
abs(llElements[m_currentEl].
value)<m_epsilon);
353 m_cachedIndex = llElements[m_currentEl].index;
354 m_cachedValue = llElements[m_currentEl].value;
373 #endif // EIGEN_AMBIVECTOR_H
void setBounds(Index start, Index end)
iterative scaling algorithm to equilibrate rows and column norms in matrices
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define eigen_internal_assert(x)
NumTraits< Scalar >::Real RealScalar
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > abs() const
Iterator(const AmbiVector &vec, const RealScalar &epsilon=0)
void init(double estimatedDensity)
const AmbiVector & m_vector
Index m_allocatedElements
Scalar & coeffRef(Index i)
void reallocate(Index size)
NumTraits< Scalar >::Real RealScalar