Skip to content

Commit f4bfeb7

Browse files
committed
ensum tets marginals sinkhorn
1 parent ace7796 commit f4bfeb7

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ot/bregman.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,7 @@ def sinkhorn_knopp(a, b, M, reg, numItermax=1000,
396396
log['v'] = v
397397

398398
if nbb: # return only loss
399-
res = np.zeros((nbb))
400-
for i in range(nbb):
401-
res[i] = np.sum(
402-
u[:, i].reshape((-1, 1)) * K * v[:, i].reshape((1, -1)) * M)
399+
res = np.einsum('ik,ij,jk,ij->k', u, K, v, M)
403400
if log:
404401
return res, log
405402
else:

0 commit comments

Comments
 (0)