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

Method sqrtm

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

Source from the content-addressed store, hash-verified

1838 return jnp.linalg.pinv(a, hermitian=hermitian)
1839
1840 def sqrtm(self, a):
1841 L, V = jnp.linalg.eigh(a)
1842 L = jnp.sqrt(L)
1843 # Q[...] = V[...] @ diag(L[...])
1844 Q = jnp.einsum("...jk,...k->...jk", V, L)
1845 # R[...] = Q[...] @ V[...].T
1846 return jnp.einsum("...jk,...kl->...jl", Q, jnp.swapaxes(V, -1, -2))
1847
1848 def eigh(self, a):
1849 return jnp.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