From cef65063cec641a93973b38a48e100fdd115db44 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 23 Aug 2014 22:59:16 +0100 Subject: rewritten grammar --- fast/test/test_sparse_vector.cc | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 fast/test/test_sparse_vector.cc (limited to 'fast/test/test_sparse_vector.cc') diff --git a/fast/test/test_sparse_vector.cc b/fast/test/test_sparse_vector.cc new file mode 100644 index 0000000..426bed1 --- /dev/null +++ b/fast/test/test_sparse_vector.cc @@ -0,0 +1,37 @@ +#include "sparse_vector.hh" + + +int +main(void) +{ + Sv::SparseVector a; + a.insert("1", 1); + a.insert("2", 2); + cout << "a:" << a << endl; + + Sv::SparseVector b; + b.insert("2", 2); + cout << "b:" << b << endl; + + Sv::SparseVector 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* sv = new Sv::SparseVector(s); + cout << *sv << endl; + cout << sv->dot(*sv) << endl; + + return 0; +} + -- cgit v1.2.3