From 3ea35e45014201a2ddbee19c400c6914495ace78 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Fri, 30 Jan 2015 16:21:41 +0100 Subject: dtrain: fix_features --- utils/fast_sparse_vector.h | 6 ++++++ 1 file changed, 6 insertions(+) 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 + inline void cw_mult(FastSparseVector& 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) { -- cgit v1.2.3