mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-19 08:07:36 +08:00
Fix prunning in (sparse*sparse).pruned() when the result is nearly dense.
This commit is contained in:
parent
0256c52359
commit
a1ff24f96a
@ -336,7 +336,7 @@ class AmbiVector<_Scalar,_StorageIndex>::Iterator
|
|||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
++m_cachedIndex;
|
++m_cachedIndex;
|
||||||
} while (m_cachedIndex<m_vector.m_end && abs(m_vector.m_buffer[m_cachedIndex])<m_epsilon);
|
} while (m_cachedIndex<m_vector.m_end && abs(m_vector.m_buffer[m_cachedIndex])<=m_epsilon);
|
||||||
if (m_cachedIndex<m_vector.m_end)
|
if (m_cachedIndex<m_vector.m_end)
|
||||||
m_cachedValue = m_vector.m_buffer[m_cachedIndex];
|
m_cachedValue = m_vector.m_buffer[m_cachedIndex];
|
||||||
else
|
else
|
||||||
@ -347,7 +347,7 @@ class AmbiVector<_Scalar,_StorageIndex>::Iterator
|
|||||||
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
|
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
|
||||||
do {
|
do {
|
||||||
m_currentEl = llElements[m_currentEl].next;
|
m_currentEl = llElements[m_currentEl].next;
|
||||||
} while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<m_epsilon);
|
} while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<=m_epsilon);
|
||||||
if (m_currentEl<0)
|
if (m_currentEl<0)
|
||||||
{
|
{
|
||||||
m_cachedIndex = -1;
|
m_cachedIndex = -1;
|
||||||
@ -363,9 +363,9 @@ class AmbiVector<_Scalar,_StorageIndex>::Iterator
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
const AmbiVector& m_vector; // the target vector
|
const AmbiVector& m_vector; // the target vector
|
||||||
StorageIndex m_currentEl; // the current element in sparse/linked-list mode
|
StorageIndex m_currentEl; // the current element in sparse/linked-list mode
|
||||||
RealScalar m_epsilon; // epsilon used to prune zero coefficients
|
RealScalar m_epsilon; // epsilon used to prune zero coefficients
|
||||||
StorageIndex m_cachedIndex; // current coordinate
|
StorageIndex m_cachedIndex; // current coordinate
|
||||||
Scalar m_cachedValue; // current value
|
Scalar m_cachedValue; // current value
|
||||||
bool m_isDense; // mode of the vector
|
bool m_isDense; // mode of the vector
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user