MCPcopy Create free account
hub / github.com/PythonOT/POT / eigsorted

Function eigsorted

examples/gaussian_gmm/plot_GMM_flow.py:58–63  ·  view source on GitHub ↗
(cov)

Source from the content-addressed store, hash-verified

56
57def draw_cov(mu, C, color=None, label=None, nstd=1, alpha=0.5):
58 def eigsorted(cov):
59 if torch.is_tensor(cov):
60 cov = cov.detach().numpy()
61 vals, vecs = np.linalg.eigh(cov)
62 order = vals.argsort()[::-1].copy()
63 return vals[order], vecs[:, order]
64
65 vals, vecs = eigsorted(C)
66 theta = np.degrees(np.arctan2(*vecs[:, 0][::-1]))

Callers 1

draw_covFunction · 0.70

Calls 4

detachMethod · 0.80
eighMethod · 0.45
copyMethod · 0.45
argsortMethod · 0.45

Tested by

no test coverage detected