From b9641702ba7aa86e9cc7ed0d4fffa4dd6271cc8f Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Thu, 13 Oct 2011 19:20:20 +0200
Subject: svm impl, faster
---
utils/fast_sparse_vector.h | 8 ++++++++
1 file changed, 8 insertions(+)
(limited to 'utils/fast_sparse_vector.h')
diff --git a/utils/fast_sparse_vector.h b/utils/fast_sparse_vector.h
index 1301581a..8daaac85 100644
--- a/utils/fast_sparse_vector.h
+++ b/utils/fast_sparse_vector.h
@@ -214,6 +214,14 @@ class FastSparseVector {
}
return *this;
}
+ template
+ inline FastSparseVector& plus_eq_v_times_s(const FastSparseVector& other, const O scalar) {
+ const typename FastSparseVector::const_iterator end = other.end();
+ for (typename FastSparseVector::const_iterator it = other.begin(); it != end; ++it) {
+ get_or_create_bin(it->first) += it->second * scalar;
+ }
+ return *this;
+ }
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