-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdemo.py
More file actions
49 lines (31 loc) · 655 Bytes
/
Copy pathdemo.py
File metadata and controls
49 lines (31 loc) · 655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import numpy as np
from km_matcher import KMMatcher
'''
weights = np.array([
[2, 3, 0, 3],
[0, 4, 4, 0],
[5, 6, 0, 0],
[0, 0, 7, 0]
# [-2, -6, -4],
# [-3, -1, -2],
# [-5, -4, -3]
# [3, 0, 4],
# [2, 1, 3],
# [0, 0, 5]
]).astype(np.float32)
'''
matcher = KMMatcher([
[2, 3, 0, 3],
[0, 4, 4, 0],
[5, 6, 0, 0],
[0, 0, 7, 0]
])
matcher.solve(verbose=True)
import time
n, m = 10, 1000000
weights = np.random.randn(n, m)
st = time.time()
matcher = KMMatcher(weights)
best = matcher.solve()
ed = time.time()
print('time consuming of size ({}, {}) is {:.4f} seconds'.format(n, m, ed - st))