Skip to content

Commit

Permalink
more permute tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmoutinho committed Aug 15, 2024
1 parent 13e76b7 commit 21c74d8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/test_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
pi = torch.tensor(torch.pi)


@pytest.mark.parametrize("use_permute", [True, False])
@pytest.mark.parametrize("use_full_support", [True, False])
@pytest.mark.parametrize("n_qubits", [4, 5])
@pytest.mark.parametrize("batch_size", [1, 5])
Expand Down Expand Up @@ -267,8 +268,8 @@ def test_permute_tensor(n_qubits: int) -> None:

perm = op_concrete1._qubit_support.qubits

assert torch.allclose(mat1, permute_basis(mat2, perm))
assert torch.allclose(mat2, permute_basis(mat1, perm, inv=True))
assert torch.allclose(mat1, permute_basis(mat2, perm, inv=True))
assert torch.allclose(mat2, permute_basis(mat1, perm))


@pytest.mark.parametrize("n_qubits", [3, 5])
Expand All @@ -287,8 +288,8 @@ def test_permute_tensor_parametric(n_qubits: int, batch_size: int) -> None:

perm = op_concrete1._qubit_support.qubits

assert torch.allclose(mat1, permute_basis(mat2, perm))
assert torch.allclose(mat2, permute_basis(mat1, perm, inv=True))
assert torch.allclose(mat1, permute_basis(mat2, perm, inv=True))
assert torch.allclose(mat2, permute_basis(mat1, perm))


def test_tensor_symmetries() -> None:
Expand Down

0 comments on commit 21c74d8

Please sign in to comment.