blob: accaf236abe3fb974ceeec2064631e4cac63b293 [file] [log] [blame]
Wenzel Jakob9e0a0562016-05-05 20:33:54 +02001#!/usr/bin/env python
2from __future__ import print_function
3import sys
4sys.path.append('.')
5
6from example import fixed_r, fixed_c
7from example import fixed_passthrough_r, fixed_passthrough_c
8from example import dense_r, dense_c
9from example import dense_passthrough_r, dense_passthrough_c
10from example import sparse_r, sparse_c
11from example import sparse_passthrough_r, sparse_passthrough_c
12import numpy as np
13
14ref = np.array(
15 [[0, 3, 0, 0, 0, 11],
16 [22, 0, 0, 0, 17, 11],
17 [7, 5, 0, 1, 0, 11],
18 [0, 0, 0, 0, 0, 11],
19 [0, 0, 14, 0, 8, 11]])
20
21
22def check(mat):
23 return 'OK' if np.sum(mat - ref) == 0 else 'NOT OK'
24
25print("fixed_r = %s" % check(fixed_r()))
26print("fixed_c = %s" % check(fixed_c()))
27print("pt_r(fixed_r) = %s" % check(fixed_passthrough_r(fixed_r())))
28print("pt_c(fixed_c) = %s" % check(fixed_passthrough_c(fixed_c())))
29print("pt_r(fixed_c) = %s" % check(fixed_passthrough_r(fixed_c())))
30print("pt_c(fixed_r) = %s" % check(fixed_passthrough_c(fixed_r())))
31
32print("dense_r = %s" % check(dense_r()))
33print("dense_c = %s" % check(dense_c()))
34print("pt_r(dense_r) = %s" % check(dense_passthrough_r(dense_r())))
35print("pt_c(dense_c) = %s" % check(dense_passthrough_c(dense_c())))
36print("pt_r(dense_c) = %s" % check(dense_passthrough_r(dense_c())))
37print("pt_c(dense_r) = %s" % check(dense_passthrough_c(dense_r())))
38
39print("sparse_r = %s" % check(sparse_r()))
40print("sparse_c = %s" % check(sparse_c()))
41print("pt_r(sparse_r) = %s" % check(sparse_passthrough_r(sparse_r())))
42print("pt_c(sparse_c) = %s" % check(sparse_passthrough_c(sparse_c())))
43print("pt_r(sparse_c) = %s" % check(sparse_passthrough_r(sparse_c())))
44print("pt_c(sparse_r) = %s" % check(sparse_passthrough_c(sparse_r())))