summaryrefslogtreecommitdiff
path: root/python/src/vectors.pxi
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2012-07-06 11:45:32 +0200
committerPatrick Simianer <p@simianer.de>2012-07-06 11:45:32 +0200
commit45a1af0ff9c164978f91b2734fb24c45551aa25c (patch)
treea3cb13ccc47386b2e51e1fb50fa9a96d5d7fa905 /python/src/vectors.pxi
parent4ec3625b3a1aa9cb417f8a551ad6723626a4c656 (diff)
parent757f56e391bd2e1d7442ab38fc98aff00d064d38 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'python/src/vectors.pxi')
-rw-r--r--python/src/vectors.pxi6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/src/vectors.pxi b/python/src/vectors.pxi
index fc0c365f..ce95968c 100644
--- a/python/src/vectors.pxi
+++ b/python/src/vectors.pxi
@@ -80,6 +80,12 @@ cdef class SparseVector:
def __contains__(self, char* fname):
return self.vector.nonzero(FDConvert(fname))
+
+ def __neg__(self):
+ cdef SparseVector result = SparseVector()
+ result.vector = new FastSparseVector[weight_t](self.vector[0])
+ result.vector[0] *= -1.0
+ return result
def __iadd__(SparseVector self, SparseVector other):
self.vector[0] += other.vector[0]