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

Function clean_zeros

ot/utils.py:251–256  ·  view source on GitHub ↗

r"""Remove all components with zeros weights in :math:`\mathbf{a}` and :math:`\mathbf{b}`

(a, b, M)

Source from the content-addressed store, hash-verified

249
250
251def clean_zeros(a, b, M):
252 r"""Remove all components with zeros weights in :math:`\mathbf{a}` and :math:`\mathbf{b}`"""
253 M2 = M[a > 0, :][:, b > 0].copy() # copy force c style matrix (froemd)
254 a2 = a[a > 0]
255 b2 = b[b > 0]
256 return a2, b2, M2
257
258
259def euclidean_distances(X, Y, squared=False, nx=None):

Callers

nothing calls this directly

Calls 1

copyMethod · 0.45

Tested by

no test coverage detected