Skip to content

Commit 1d49410

Browse files
committed
implement for loop
1 parent 55e8392 commit 1d49410

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ot/bregman.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ def greenkhorn(a, b, M, reg, numItermax=10000, stopThr=1e-9, verbose=False, log=
520520
log['u'] = u
521521
log['v'] = v
522522

523-
while i < numItermax and stopThr_val > stopThr:
523+
for i in range(numItermax):
524524
i += 1
525525
i_1 = np.argmax(np.abs(viol))
526526
i_2 = np.argmax(np.abs(viol_2))
@@ -547,6 +547,11 @@ def greenkhorn(a, b, M, reg, numItermax=10000, stopThr=1e-9, verbose=False, log=
547547

548548
#print('b',np.max(abs(aviol -viol)),np.max(abs(aviol_2 - viol_2)))
549549

550+
if stopThr_val <= stopThr:
551+
break
552+
else:
553+
print('Warning: Algorithm did not converge')
554+
550555
if log:
551556
log['u'] = u
552557
log['v'] = v

0 commit comments

Comments
 (0)