diff options
author | Patrick Simianer <p@simianer.de> | 2014-09-16 10:23:14 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-09-16 10:23:14 +0100 |
commit | 129a22cfcc7651daa4b11ed52e7870249f6373a5 (patch) | |
tree | 78de4649396ab0d37a325b7598f9873c2d65f4c9 /src/test_sparse_vector.cc | |
parent | df70006a07fb67b17fb39aa56762c50c2e7b8131 (diff) |
spring cleaning
Diffstat (limited to 'src/test_sparse_vector.cc')
-rw-r--r-- | src/test_sparse_vector.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test_sparse_vector.cc b/src/test_sparse_vector.cc new file mode 100644 index 0000000..69aaa21 --- /dev/null +++ b/src/test_sparse_vector.cc @@ -0,0 +1,36 @@ +#include "sparse_vector.hh" + +int +main(void) +{ + Sv::SparseVector<string, score_t> a; + a.insert("1", 1); + a.insert("2", 2); + cout << "a:" << a << endl; + + Sv::SparseVector<string, score_t> b; + b.insert("2", 2); + cout << "b:" << b << endl; + + Sv::SparseVector<string, score_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; + + string s("\"a\"=2 \"b\"=3"); + Sv::SparseVector<string, score_t>* sv = new Sv::SparseVector<string, score_t>(s); + cout << *sv << endl; + cout << sv->dot(*sv) << endl; + + return 0; +} + |