Skip to content

Commit

Permalink
simplified test
Browse files Browse the repository at this point in the history
  • Loading branch information
ziofil committed Aug 23, 2023
1 parent 59288f8 commit 3b984cd
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/test_lab/test_representations/test_data/test_matvec_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
The fixtures must correspond to the concrete class being tested, here MatVecData.
"""

import numpy as np
import operator as op
import pytest

from copy import deepcopy

import numpy as np
import pytest

from mrmustard import settings
from mrmustard.lab.representations.data.matvec_data import MatVecData
from mrmustard.typing import Batch, Matrix, Scalar, Vector
from mrmustard.utils.misc_tools import general_factory
Expand All @@ -34,8 +35,6 @@
helper_mat_vec_unchanged_computed_coeffs_are_correct,
)

from mrmustard import settings

settings.SEED = 42

D = 10 # dimension, matrix will be DxD while means will be D
Expand Down Expand Up @@ -169,12 +168,15 @@ def test_scalar_mul_or_div_if_mat_vec_same_dont_change_mat_vec_but_change_coeffs
norms_of_vecs_postop = set(np.around([f(v) for v in postop_data.mat], precision))
coeffs_preop = set(np.around(preop_data.coeffs, precision))
coeffs_postop = set(np.around(postop_data.coeffs, precision))
assert norms_of_mats_preop.symmetric_difference(norms_of_mats_postop) == set()
assert norms_of_vecs_preop.symmetric_difference(norms_of_vecs_postop) == set()
assert coeffs_preop.symmetric_difference(coeffs_postop) != set()
assert norms_of_mats_preop == norms_of_mats_postop
assert norms_of_vecs_preop == norms_of_vecs_postop
assert coeffs_preop != coeffs_postop

# ############### Tensor product ##################
# TODO: to test in children

# ############### Multiplication ##################
# NOTE: tested in children

# ############### Outer product ##################
# # NOTE: not implented yet so no tests
# NOTE: not implented yet so no tests

0 comments on commit 3b984cd

Please sign in to comment.