Skip to content

Commit

Permalink
wire_order tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albi3ro committed Jun 3, 2022
1 parent 8966b5b commit 09d0324
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/ops/op_math/test_pow_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,21 @@ def test_matrix_against_shortcut_jax(self, z):
param = tf.Variable(2.34)
assert self.check_matrix(param, z)

def test_matrix_wire_order(self):
"""Test that the wire_order keyword rearranges ording."""

param = 1.234
z = 3
base = qml.IsingXX(param, wires=(0, 1))
op = Pow(base, z)

compare_op = qml.IsingXX(param * z, wires=(0, 1))

op_mat = op.matrix(wire_order=(1, 0))
compare_mat = compare_op.matrix(wire_order=(1, 0))

assert qml.math.allclose(op_mat, compare_mat)


class TestSparseMatrix:
"""Tests involving the sparse matrix method."""
Expand Down

0 comments on commit 09d0324

Please sign in to comment.