diff options
-rw-r--r-- | utils/fast_sparse_vector.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/utils/fast_sparse_vector.h b/utils/fast_sparse_vector.h index 1e0ab428..4e197f73 100644 --- a/utils/fast_sparse_vector.h +++ b/utils/fast_sparse_vector.h @@ -319,6 +319,12 @@ class FastSparseVector { get_or_create_bin(it->first) += it->second * scalar; } } + template <typename O> + inline void cw_mult(FastSparseVector<O>& other) { + for (iterator it = begin(); it != end(); ++it) { + it->second = other[it->first] * it->second; + } + } inline FastSparseVector& operator-=(const FastSparseVector& other) { const typename FastSparseVector::const_iterator end = other.end(); for (typename FastSparseVector::const_iterator it = other.begin(); it != end; ++it) { |