summaryrefslogtreecommitdiff
path: root/fast/test_sparse_vector.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-07-22 00:34:01 +0200
committerPatrick Simianer <p@simianer.de>2014-07-22 00:34:01 +0200
commit4b7b2693e829166ccec8707b59fb2bc26179551b (patch)
tree1c103865488aa8cefabf9714cd571066135b8ca4 /fast/test_sparse_vector.cc
parent02bbe0c6bc69283a988caf8f0ab3dadb5d9d72b5 (diff)
simple sparse vector type
Diffstat (limited to 'fast/test_sparse_vector.cc')
-rw-r--r--fast/test_sparse_vector.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/fast/test_sparse_vector.cc b/fast/test_sparse_vector.cc
new file mode 100644
index 0000000..f486486
--- /dev/null
+++ b/fast/test_sparse_vector.cc
@@ -0,0 +1,32 @@
+#include "sparse_vector.hh"
+
+
+int
+main(void)
+{
+ Sv::SparseVector<string, weight_t> a;
+ a.insert("1", 1);
+ a.insert("2", 2);
+ cout << "a:" << a << endl;
+
+ Sv::SparseVector<string, weight_t> b;
+ b.insert("2", 2);
+ cout << "b:" << b << endl;
+
+ Sv::SparseVector<string, weight_t> c = a + b;
+ cout << "a+b:" << c << endl;
+
+ a += b;
+ cout << "a+=b:" << a << endl;
+
+ a -= b;
+ cout << "a-=b:" << a << endl;
+
+ cout << "a*2:" << a*2 << endl;
+
+ a *= 2;
+ cout << "a*=2:" << a << endl;
+
+ return 0;
+}
+