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

Method sqrtm

ot/backend.py:1412–1418  ·  view source on GitHub ↗
(self, a)

Source from the content-addressed store, hash-verified

1410 return np.linalg.pinv(a, hermitian=hermitian)
1411
1412 def sqrtm(self, a):
1413 L, V = np.linalg.eigh(a)
1414 L = np.sqrt(L)
1415 # Q[...] = V[...] @ diag(L[...])
1416 Q = np.einsum("...jk,...k->...jk", V, L)
1417 # R[...] = Q[...] @ V[...].T
1418 return np.einsum("...jk,...kl->...jl", Q, np.swapaxes(V, -1, -2))
1419
1420 def eigh(self, a):
1421 return np.linalg.eigh(a)

Callers

nothing calls this directly

Calls 3

eighMethod · 0.45
sqrtMethod · 0.45
einsumMethod · 0.45

Tested by

no test coverage detected