Sparse module:

* extend unit tests
* add support for generic sum reduction and dot product
* optimize the cwise()* : this is a special case of CwiseBinaryOp where
  we only have to process the coeffs which are not null for *both* matrices.
  Perhaps there exist some other binary operations like that ?
This commit is contained in:
Gael Guennebaud
2009-01-07 17:01:57 +00:00
parent 7078cfaeaa
commit 709e903335
9 changed files with 382 additions and 39 deletions

View File

@@ -272,6 +272,28 @@ class SparseVector
return s;
}
// this specialized version does not seems to be faster
// Scalar dot(const SparseVector& other) const
// {
// int i=0, j=0;
// Scalar res = 0;
// asm("#begindot");
// while (i<nonZeros() && j<other.nonZeros())
// {
// if (m_data.index(i)==other.m_data.index(j))
// {
// res += m_data.value(i) * ei_conj(other.m_data.value(j));
// ++i; ++j;
// }
// else if (m_data.index(i)<other.m_data.index(j))
// ++i;
// else
// ++j;
// }
// asm("#enddot");
// return res;
// }
/** Destructor */
inline ~SparseVector() {}
};