r"""Remove all components with zeros weights in :math:`\mathbf{a}` and :math:`\mathbf{b}`
(a, b, M)
| 249 | |
| 250 | |
| 251 | def 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 | |
| 259 | def euclidean_distances(X, Y, squared=False, nx=None): |