diff options
author | Patrick Simianer <p@simianer.de> | 2015-01-30 16:21:41 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2015-01-30 16:21:41 +0100 |
commit | 3ea35e45014201a2ddbee19c400c6914495ace78 (patch) | |
tree | e2458f61e623869014ac1aef226ee4c1635865e2 /utils | |
parent | 88a597f7bea6cd8325b48678dfaf874fae4d660d (diff) |
dtrain: fix_features
Diffstat (limited to 'utils')
-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) { |