Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump qiskit version used during qasm compatibility test #2511

Merged
merged 3 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions cirq/testing/consistent_qasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def assert_qasm_is_consistent_with_unitary(val: Any):
qasm_unitary = None
try:
result = qiskit.execute(
qiskit.load_qasm_string(qasm),
qiskit.QuantumCircuit.from_qasm_str(qasm),
backend=qiskit.Aer.get_backend('unitary_simulator'))
qasm_unitary = result.result().get_unitary()
qasm_unitary = _reorder_indices_of_matrix(
Expand All @@ -89,21 +89,20 @@ def assert_qasm_is_consistent_with_unitary(val: Any):
p_unitary = None
p_qasm_unitary = None
raise AssertionError(
'QASM be consistent with cirq.unitary(op) up to global phase.\n\n'
'QASM not consistent with cirq.unitary(op) up to global phase.\n\n'
'op:\n{}\n\n'
'cirq.unitary(op):\n{}\n\n'
'Generated QASM:\n\n{}\n\n'
'Unitary of generated QASM:\n{}\n\n'
'Phased matched cirq.unitary(op):\n{}\n\n'
'Phased matched unitary of generated QASM:\n{}\n\n'
'Underlying error:\n{}'.format(
_indent(repr(op)),
_indent(repr(unitary)),
_indent(qasm),
_indent(repr(qasm_unitary)),
_indent(repr(p_unitary)),
_indent(repr(p_qasm_unitary)),
_indent(str(ex))))
'Underlying error:\n{}'.format(_indent(repr(op)),
_indent(repr(unitary)),
_indent(qasm),
_indent(repr(qasm_unitary)),
_indent(repr(p_unitary)),
_indent(repr(p_qasm_unitary)),
_indent(str(ex))))


def assert_qiskit_parsed_qasm_consistent_with_unitary(qasm, unitary):
Expand All @@ -116,7 +115,7 @@ def assert_qiskit_parsed_qasm_consistent_with_unitary(qasm, unitary):
return

num_qubits = int(np.log2(len(unitary)))
result = qiskit.execute(qiskit.load_qasm_string(qasm),
result = qiskit.execute(qiskit.QuantumCircuit.from_qasm_str(qasm),
backend=qiskit.Aer.get_backend('unitary_simulator'))
qiskit_unitary = result.result().get_unitary()
qiskit_unitary = _reorder_indices_of_matrix(
Expand Down
2 changes: 1 addition & 1 deletion dev_tools/conf/pip-list-dev-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mypy-protobuf==1.10
twine

# For verifying behavior of qasm output.
qiskit~=0.6.0
qiskit~=0.13.0

# For generating documentation.
pypandoc
Expand Down