Skip to content

Commit 87c84bb

Browse files
committed
optimize numpy dot product
In numpy 1.26 `a.dot(b.T)` is 6.5 times slower than `c = b.T.copy()` `a.dot(c)`
1 parent 75c07f7 commit 87c84bb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ALLCools/integration/cca.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def cca(
7272

7373
# CCA decomposition
7474
model = TruncatedSVD(n_components=n_components, algorithm=svd_algorithm, random_state=random_state)
75-
U = model.fit_transform(tf_data1.dot(tf_data2.T))
75+
tf_data2_t = tf_data2.T.copy()
76+
U = model.fit_transform(tf_data1.dot(tf_data2_t))
7677

7778
# select dimensions with non-zero singular values
7879
sel_dim = model.singular_values_ != 0

0 commit comments

Comments
 (0)