Skip to content

Commit

Permalink
Fix matrix acccess in tests (#100)
Browse files Browse the repository at this point in the history
* matrix update

* matrix update
  • Loading branch information
antalszava committed Jun 7, 2022
1 parent d3eb2f2 commit ee8b9a0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/test_numpy_wavefunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_apply(self, op, apply_unitary, tol):
elif op.name == "PSWAP":
state = apply_unitary(test_operation_map["PSWAP"](0.432), 3)
else:
state = apply_unitary(op.matrix, 3)
state = apply_unitary(qml.matrix(op), 3)

with qml.tape.QuantumTape() as tape:
qml.apply(op)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_cphase_decomposition(self, phi, q, tol):
calculated_matrix = np.eye(4, dtype=complex)
default_qubit = qml.device("default.qubit", wires=2)
for gate in decomposition:
gate_matrix = gate.matrix
gate_matrix = qml.matrix(gate)

if gate.num_wires == 1:
if gate.wires[0] == 0:
Expand All @@ -45,7 +45,7 @@ def test_pswap_decomposition(self, phi, tol):
calculated_matrix = np.eye(4, dtype=complex)
default_qubit = qml.device("default.qubit", wires=2)
for gate in decomposition:
gate_matrix = gate.matrix
gate_matrix = qml.matrix(gate)

if gate.num_wires == 1:
if gate.wires[0] == 0:
Expand All @@ -67,7 +67,7 @@ def test_iswap_decomposition(self, tol):
calculated_matrix = np.eye(4, dtype=complex)
default_qubit = qml.device("default.qubit", wires=2)
for gate in decomposition:
gate_matrix = gate.matrix
gate_matrix = qml.matrix(gate)

if gate.num_wires == 1:
if gate.wires[0] == 0:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_qvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def test_apply(self, op, apply_unitary, shots, qvm, compiler):
elif op.name == "PSWAP":
state = apply_unitary(test_operation_map["PSWAP"](0.432), 3)
else:
state = apply_unitary(op.matrix, 3)
state = apply_unitary(qml.matrix(op), 3)

with qml.tape.QuantumTape() as tape:
qml.apply(op)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wavefunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_apply(self, op, apply_unitary, tol):
elif op.name == "PSWAP":
state = apply_unitary(test_operation_map["PSWAP"](0.432), 3)
else:
state = apply_unitary(op.matrix, 3)
state = apply_unitary(qml.matrix(op), 3)

with qml.tape.QuantumTape() as tape:
qml.apply(op)
Expand Down

0 comments on commit ee8b9a0

Please sign in to comment.