From f1e14ed129a1f5917995e3e900675b73bf9e0869 Mon Sep 17 00:00:00 2001 From: Alex Barcelo Date: Wed, 20 Oct 2021 12:43:25 +0200 Subject: [PATCH] Improper use of combinations_with_replacement AFAIU, this is equivalent, more readable, more compact, and more performant. --- dislib/math/base.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dislib/math/base.py b/dislib/math/base.py index 4adb8b62..16a464b6 100644 --- a/dislib/math/base.py +++ b/dislib/math/base.py @@ -168,13 +168,11 @@ def svd(a, compute_uv=True, sort=True, copy=True, eps=1e-9): while not _check_convergence_svd(checks): checks = [] - pairings = itertools.combinations_with_replacement( + pairings = itertools.combinations( range(x._n_blocks[1]), 2 ) for i, j in pairings: - if i >= j: - continue coli_x = x._get_col_block(i) colj_x = x._get_col_block(j)