mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 16:49:38 +08:00
Fix inner iterator for sparse block.
This commit is contained in:
parent
39d22ef46b
commit
5a1c7807e6
@ -196,8 +196,7 @@ class SparseCompressedBase<Derived>::InnerIterator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit InnerIterator(const SparseCompressedBase& mat)
|
explicit InnerIterator(const SparseCompressedBase& mat) : InnerIterator(mat, Index(0))
|
||||||
: m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(0), m_id(0), m_end(mat.nonZeros())
|
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
|
||||||
}
|
}
|
||||||
|
@ -288,6 +288,25 @@ template<typename SparseMatrixType> void sparse_block(const SparseMatrixType& re
|
|||||||
VERIFY_IS_APPROX(m3, refMat3);
|
VERIFY_IS_APPROX(m3, refMat3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Explicit inner iterator.
|
||||||
|
{
|
||||||
|
DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols);
|
||||||
|
SparseMatrixType m2(rows, cols);
|
||||||
|
initSparse<Scalar>(density, refMat2, m2);
|
||||||
|
|
||||||
|
Index j0 =internal::random<Index>(0, outer - 1);
|
||||||
|
auto v = innervec(m2, j0);
|
||||||
|
|
||||||
|
typename decltype(v)::InnerIterator block_iterator(v);
|
||||||
|
typename SparseMatrixType::InnerIterator matrix_iterator(m2, j0);
|
||||||
|
while (block_iterator) {
|
||||||
|
VERIFY_IS_EQUAL(block_iterator.index(), matrix_iterator.index());
|
||||||
|
++block_iterator;
|
||||||
|
++matrix_iterator;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_DECLARE_TEST(sparse_block)
|
EIGEN_DECLARE_TEST(sparse_block)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user