Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cross-similarity matrix
labels: list of strings
names of diagrams for legend. Default = ["dgm1", "dgm2"],
ax: matplotlib Axis object
For plotting on a particular axis.
Examples
==========
bn_matching, (matchidx, D) = persim.bottleneck(A_h1, B_h1, matching=True)
persim.bottleneck_matching(A_h1, B_h1, matchidx, D)
"""
plot_diagrams([I1, I2], labels=labels, ax=ax)
cp = np.cos(np.pi / 4)
sp = np.sin(np.pi / 4)
R = np.array([[cp, -sp], [sp, cp]])
if I1.size == 0:
I1 = np.array([[0, 0]])
if I2.size == 0:
I2 = np.array([[0, 0]])
I1Rot = I1.dot(R)
I2Rot = I2.dot(R)
dists = [D[i, j] for (i, j) in matchidx]
(i, j) = matchidx[np.argmax(dists)]
if i >= I1.shape[0] and j >= I2.shape[0]:
return
if i >= I1.shape[0]:
diagElem = np.array([I2Rot[j, 0], 0])
diagElem = diagElem.dot(R.T)