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

Method eliminate_zeros

ot/backend.py:2737–2745  ·  view source on GitHub ↗
(self, a, threshold=0.0)

Source from the content-addressed store, hash-verified

2735 return cupyx.scipy.sparse.csr_matrix(a)
2736
2737 def eliminate_zeros(self, a, threshold=0.0):
2738 if threshold > 0:
2739 if self.issparse(a):
2740 a.data[self.abs(a.data) <= threshold] = 0
2741 else:
2742 a[self.abs(a) <= threshold] = 0
2743 if self.issparse(a):
2744 a.eliminate_zeros()
2745 return a
2746
2747 def todense(self, a):
2748 if self.issparse(a):

Callers

nothing calls this directly

Calls 3

issparseMethod · 0.95
absMethod · 0.95
eliminate_zerosMethod · 0.45

Tested by

no test coverage detected