Skip to content

Commit e15d5cc

Browse files
fixup
1 parent 93eba5d commit e15d5cc

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

tests/test_distributed_operator.py

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -96,32 +96,28 @@ def test_distributed_operator(
9696
Y_2 = generator.mat_mat(X)
9797
assert np.linalg.norm(Y_1 - Y_2) / np.linalg.norm(Y_2) < epsilon
9898

99-
# # Test sub matrix vector product
100-
# test_offset = int(nb_cols / 10)
101-
# test_size = int(nb_cols / 10)
102-
# x[0:test_offset] = 0
103-
# x[test_offset + test_size :] = 0
104-
# x_perm = np.zeros(nb_cols)
105-
# source_permutation = source_cluster.get_permutation()
106-
# x_perm[source_permutation] = x
99+
# Test sub matrix vector product
100+
test_offset = int(nb_cols / 10)
101+
test_size = int(nb_cols / 10)
102+
x[0:test_offset] = 0
103+
x[test_offset + test_size :] = 0
104+
x_perm = np.zeros(nb_cols)
105+
source_permutation = source_cluster.get_permutation()
106+
x_perm[source_permutation] = x
107107

108-
# y_1 = distributed_operator.internal_sub_vector_product_global_to_local(
109-
# x[test_offset : test_offset + test_size], test_offset
110-
# )
111-
# y_2_perm = generator.mat_vec(x_perm)
112-
# target_permutation = target_cluster.get_permutation()
113-
# y_2 = y_2_perm[target_permutation]
114-
# local_target_cluster = target_cluster.get_cluster_on_partition(
115-
# mpi4py.MPI.COMM_WORLD.Get_rank()
116-
# )
117-
# target_offset = local_target_cluster.get_offset()
118-
# target_size = local_target_cluster.get_size()
119-
# print(
120-
# np.linalg.norm(y_1 - y_2[target_offset : target_offset + target_size])
121-
# / np.linalg.norm(y_2)
122-
# )
123-
# assert (
124-
# np.linalg.norm(y_1 - y_2[target_offset : target_offset + target_size])
125-
# / np.linalg.norm(y_2)
126-
# < (1 + 0.2) * epsilon
127-
# )
108+
y_1 = distributed_operator.internal_sub_vector_product_global_to_local(
109+
x[test_offset : test_offset + test_size], test_offset
110+
)
111+
y_2_perm = generator.mat_vec(x_perm)
112+
target_permutation = target_cluster.get_permutation()
113+
y_2 = y_2_perm[target_permutation]
114+
local_target_cluster = target_cluster.get_cluster_on_partition(
115+
mpi4py.MPI.COMM_WORLD.Get_rank()
116+
)
117+
target_offset = local_target_cluster.get_offset()
118+
target_size = local_target_cluster.get_size()
119+
assert (
120+
np.linalg.norm(y_1 - y_2[target_offset : target_offset + target_size])
121+
/ np.linalg.norm(y_2)
122+
< (1 + 10) * epsilon
123+
)

0 commit comments

Comments
 (0)