mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
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:
@@ -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() {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user