add a novel, experimental sparse product

This commit is contained in:
Gael Guennebaud
2010-01-05 15:57:16 +01:00
parent 1837b65b28
commit d8534be728
4 changed files with 232 additions and 4 deletions

View File

@@ -201,6 +201,14 @@ class SparseMatrix
return m_data.value(id);
}
inline Scalar& insertBackNoCheck(int outer, int inner)
{
int id = m_outerIndex[outer+1];
++m_outerIndex[outer+1];
m_data.append(0, inner);
return m_data.value(id);
}
inline void startVec(int outer)
{
ei_assert(m_outerIndex[outer]==int(m_data.size()) && "you must call startVec on each inner vec");
@@ -443,7 +451,7 @@ class SparseMatrix
}
template<typename OtherDerived>
inline SparseMatrix& operator=(const SparseMatrixBase<OtherDerived>& other)
EIGEN_DONT_INLINE SparseMatrix& operator=(const SparseMatrixBase<OtherDerived>& other)
{
const bool needToTranspose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);
if (needToTranspose)
@@ -479,13 +487,14 @@ class SparseMatrix
m_data.resize(count);
// pass 2
for (int j=0; j<otherCopy.outerSize(); ++j)
{
for (typename _OtherCopy::InnerIterator it(otherCopy, j); it; ++it)
{
int pos = positions[it.index()]++;
m_data.index(pos) = j;
m_data.value(pos) = it.value();
}
}
return *this;
}
else