(m1, m2, shape)
| 20 | 9: 16.919} |
| 21 | |
| 22 | def merge_matches(m1, m2, shape): |
| 23 | O,P,Q = shape |
| 24 | m1 = np.asarray(m1) |
| 25 | m2 = np.asarray(m2) |
| 26 | |
| 27 | M1 = scipy.sparse.coo_matrix((np.ones(len(m1)), (m1[:, 0], m1[:, 1])), shape=(O, P)) |
| 28 | M2 = scipy.sparse.coo_matrix((np.ones(len(m2)), (m2[:, 0], m2[:, 1])), shape=(P, Q)) |
| 29 | |
| 30 | mask = M1*M2 |
| 31 | match = mask.nonzero() |
| 32 | match = list(zip(match[0], match[1])) |
| 33 | unmatched_O = tuple(set(range(O)) - set([i for i, j in match])) |
| 34 | unmatched_Q = tuple(set(range(Q)) - set([j for i, j in match])) |
| 35 | |
| 36 | return match, unmatched_O, unmatched_Q |
| 37 | |
| 38 | |
| 39 | def _indices_to_matches(cost_matrix, indices, thresh): |
nothing calls this directly
no outgoing calls
no test coverage detected