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

Allow ParameterExpression values in TemplateOptimization pass #6899

Merged
merged 142 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
32ee4db
added new equivalence rzx_zz4
nbronn Apr 19, 2021
8cfc6d9
added another zz-ish template (looks for basis gates)
nbronn Apr 27, 2021
c063402
Merge branch 'master' of github.com:Qiskit/qiskit-terra into template…
nbronn Apr 27, 2021
1d290a4
put the rzx_templates in
nbronn Jun 24, 2021
ad85838
looking at adding additions to rzx templates
nbronn Jul 1, 2021
7098e4f
fixes parsing of Parameter name for sympy during template optimization
nbronn Jul 2, 2021
3e23380
Merge branch 'main' of github.com:nbronn/qiskit-terra into template-p…
nbronn Jul 2, 2021
6e18a54
Merge branch 'main' into template-param-expression
nbronn Jul 2, 2021
c7605d7
generalized fix for multiple parameters in an expression and constant…
nbronn Jul 6, 2021
ed74ccf
one more minor fix to bring inline with qiskit-terra main
nbronn Jul 6, 2021
e308b84
trying to fix parameter parsing for template optimization
nbronn Jul 8, 2021
8fc1fa6
made sure floats were added correctly to (template) parameters
nbronn Jul 9, 2021
78d3339
got template matching to work with floats, sympy still not understand…
nbronn Jul 9, 2021
cc1a55a
Merge branch 'main' of github.com:Qiskit/qiskit-terra into template-p…
nbronn Jul 9, 2021
732e887
further modifications to accept circuit parameters for template optim…
nbronn Jul 12, 2021
0c63ca2
debugging the binding of template parameters
nbronn Jul 21, 2021
6a18dd1
realized I was not treating ParameterExpressions carefully and should…
nbronn Jul 22, 2021
133171c
converted all bindings to ParameterExpressions (via .assign()), set t…
nbronn Jul 25, 2021
caee274
cleaned up _attempt_bind routine
nbronn Jul 26, 2021
bd67056
exploring overriding removing the matched scenarios with parameters
nbronn Jul 28, 2021
38e8bde
introduced a total hack for dealing with ParamterExpressions that con…
nbronn Jul 30, 2021
a99726a
(non-latex) parameters now currently working in template optimization…
nbronn Aug 10, 2021
59009db
cleaned up some whitespace and removed commented-out lines
nbronn Aug 10, 2021
432bb3f
cleaned up some tox/lint errors
nbronn Aug 11, 2021
b308587
removed unneccessary Parameter import
nbronn Aug 11, 2021
5fd736a
Merge branch 'main' into template-param-expression
nbronn Aug 11, 2021
71aa17e
bypassed unit test test_unbound_parameters() and re-tox/lint
nbronn Aug 16, 2021
5c3a62b
Merge branch 'main' of github.com:Qiskit/qiskit-terra into template-p…
nbronn Aug 16, 2021
9f373e9
Merge branch 'template-param-expression' of github.com:nbronn/qiskit-…
nbronn Aug 16, 2021
bf590d3
fixed one last linting issue
nbronn Aug 16, 2021
0f5f0d6
fixed cyclic import error
nbronn Aug 17, 2021
4f5b69e
Merge branch 'main' into template-param-expression
nbronn Aug 17, 2021
bd3f9ed
modified calibration_creator to accept a ParameterExpression containi…
nbronn Aug 17, 2021
6c9831c
Merge branch 'template-param-expression' of github.com:nbronn/qiskit-…
nbronn Aug 17, 2021
d9530e6
fixed an mismatch when trying to add calibrations and addressed a con…
nbronn Aug 25, 2021
06b9cf1
Merge branch 'main' into template-param-expression
nbronn Aug 25, 2021
a9e7cdf
last tox/lint checks i'm sure ;)
nbronn Aug 25, 2021
4ea8ff5
moved try/except from scheduling to calibration
nbronn Aug 31, 2021
443a6c9
now params comes from node_op argument
nbronn Aug 31, 2021
04dfc37
Merge branch 'main' of github.com:Qiskit/qiskit-terra into template-p…
nbronn Sep 3, 2021
168c3cc
handling error in case gate parameters is empty in dagcircuit.py
nbronn Sep 3, 2021
0e9c39f
Merge branch 'main' of github.com:Qiskit/qiskit-terra into template-p…
nbronn Sep 17, 2021
d7b55b3
Merge branch 'main' into template-param-expression
nbronn Sep 22, 2021
0547f53
Merge branch 'main' into template-param-expression
nbronn Sep 29, 2021
fa51c3c
Fix template matching for parameters with LaTeX name.
rafal-pracht Oct 5, 2021
d4044a0
Merge pull request #1 from rafal-pracht/template-param-expression
nbronn Oct 6, 2021
19007b7
Merge branch 'main' into template-param-expression
nbronn Oct 6, 2021
d6e1cd7
Merge branch 'main' into template-param-expression
nbronn Oct 20, 2021
2065826
added missing docstring
nbronn Oct 20, 2021
a8b9b05
removed pdb set_trace
nbronn Oct 20, 2021
72990f5
Merge branch 'main' into template-param-expression
nbronn Oct 22, 2021
d177d84
Merge branch 'main' into template-param-expression
nbronn Oct 22, 2021
bd6dda4
made changes requested in PR 6899
nbronn Nov 2, 2021
6ea9d90
made changes requested in PR 6899 #2
nbronn Nov 2, 2021
592963b
Merge branch 'main' into template-param-expression
nbronn Nov 2, 2021
cebce74
remembered to tighten try/except handling
nbronn Nov 2, 2021
4e2291c
Merge branch 'template-param-expression' of github.com:nbronn/qiskit-…
nbronn Nov 2, 2021
6ccf293
Merge branch 'main' into template-param-expression
nbronn Nov 2, 2021
8b6bf37
finished making changes requested in PR 6899
nbronn Nov 3, 2021
fdffda6
Merge branch 'main' into template-param-expression
nbronn Nov 3, 2021
7721f23
fixed remaining linting issue
nbronn Nov 3, 2021
9130a2a
Merge branch 'main' into template-param-expression
nbronn Nov 3, 2021
5e31398
added comment about templates working for parameterized RZXGates and …
nbronn Nov 3, 2021
eb8ba0d
Merge branch 'template-param-expression' of github.com:nbronn/qiskit-…
nbronn Nov 3, 2021
a92b942
Merge branch 'main' into template-param-expression
nbronn Nov 4, 2021
84d65df
Merge branch 'main' into template-param-expression
nbronn Nov 5, 2021
17d5002
Merge branch 'main' into template-param-expression
nbronn Nov 9, 2021
3db29f0
Merge branch 'main' into template-param-expression
nbronn Nov 11, 2021
31b3d62
Merge branch 'main' into template-param-expression
nbronn Nov 12, 2021
1e8b009
Merge branch 'main' into template-param-expression
nbronn Nov 16, 2021
bdee233
Merge branch 'main' into template-param-expression
nbronn Nov 16, 2021
6d419de
Merge branch 'main' into template-param-expression
nbronn Nov 16, 2021
b362089
Merge branch 'main' into template-param-expression
nbronn Nov 18, 2021
2973339
Fix test unbound parameters
rafal-pracht Nov 19, 2021
bb1c797
Check if matrix with Parameter is unitary
rafal-pracht Nov 23, 2021
d531d95
Merge branch 'template-param-expression' into template-param-expression
rafal-pracht Nov 23, 2021
30706cd
Merge branch 'main' of github.com:Qiskit/qiskit-terra into template-p…
nbronn Nov 23, 2021
9260cf4
Fix merge issue
rafal-pracht Nov 24, 2021
767ccf4
Merge pull request #4 from rafal-pracht/template-param-expression
nbronn Nov 24, 2021
28b384f
Merge branch 'main' into template-param-expression
nbronn Dec 15, 2021
d55e75c
Merge branch 'template-param-expression' of github.com:nbronn/qiskit-…
nbronn Dec 15, 2021
f50c4e6
removed real=True in two symbol Symbol expressions, which was messing…
nbronn Dec 16, 2021
e32d038
generalized to iterate over parameters, and removed reference to priv…
nbronn Dec 16, 2021
c21fdf1
modified .get_sympy_expr() to use symengine if possible
nbronn Dec 16, 2021
bc42afb
made the negation of the RXGate() much less verbose
nbronn Dec 16, 2021
cce7b65
working thru tox/lint checks
nbronn Dec 16, 2021
5506200
added unit test test_unbound_parameters_in_rzx_templates to confirm t…
nbronn Dec 16, 2021
708bfcc
Fix unbund parameters test
rafal-pracht Dec 17, 2021
84d566b
Merge pull request #6 from rafal-pracht/template-param-expression
nbronn Dec 20, 2021
54403b0
fixed issue with adding calibrations without params
nbronn Dec 20, 2021
3c15da0
Merge branch 'main' into template-param-expression
nbronn Dec 20, 2021
9355893
Add real=True to symbols
rafal-pracht Dec 20, 2021
7e9f8d9
fixed linting issue
nbronn Dec 20, 2021
0a179b6
Fix for symengine
rafal-pracht Dec 20, 2021
5f86049
simplified the parameter handling for adding calibrations to gates
nbronn Dec 20, 2021
0835763
Merge pull request #7 from rafal-pracht/template-param-expression
nbronn Dec 20, 2021
680ec53
added a check for unitary on an arbitrary float in the case symengine…
nbronn Dec 20, 2021
f276cd7
Parammeter can be complex
rafal-pracht Dec 29, 2021
a295831
Merge pull request #8 from rafal-pracht/template-param-expression
nbronn Jan 3, 2022
2f244bc
Merge branch 'main' into template-param-expression
nbronn Jan 3, 2022
0434a70
Merge branch 'template-param-expression' of github.com:nbronn/qiskit-…
nbronn Jan 3, 2022
055832d
fixed tox/lint issues
nbronn Jan 4, 2022
2504c2e
removed one more imposition of real parameters
nbronn Jan 5, 2022
0f1cf5d
one last linting issue
nbronn Jan 5, 2022
c672ee3
Merge branch 'main' into template-param-expression
nbronn Jan 26, 2022
9a94bb2
modified release notes
nbronn Jan 26, 2022
48173c1
fixed some transpiler library imports that were out of date
nbronn Jan 27, 2022
24097b5
added sphinx referencing to release notes and print statement for the…
nbronn Jan 27, 2022
2f0203c
fixed some tox/lint issues
nbronn Jan 27, 2022
591763a
Fix review issues
rafal-pracht Jan 28, 2022
4dcf014
Merge branch 'main' into template-param-expression
nbronn Feb 1, 2022
8d1bc2e
Merge pull request #10 from rafal-pracht/template-param-expression
nbronn Feb 1, 2022
4f76b73
Merge branch 'template-param-expression' of github.com:nbronn/qiskit-…
nbronn Feb 2, 2022
c8a08e9
fixing last tox/lint issues
nbronn Feb 2, 2022
ee081e3
looking into tox/lint issues
nbronn Feb 11, 2022
3f740fb
added release notes and fixed tox/lint issues
nbronn Feb 11, 2022
69b8472
added method in template_substitution to compare the number of parame…
nbronn Feb 17, 2022
58c8ccf
Merge branch 'main' of github.com:Qiskit/qiskit-terra into template-p…
nbronn Feb 17, 2022
e09b1e3
fixing up some template matching unit tests
nbronn Feb 17, 2022
f01a671
fixed up template matching unit tests to remove calls to UnitaryGate
nbronn Feb 17, 2022
78a2f47
Update qiskit/dagcircuit/dagcircuit.py
nbronn Feb 23, 2022
8496a8c
Update qiskit/extensions/unitary.py
nbronn Feb 24, 2022
82470fd
Update qiskit/extensions/unitary.py
nbronn Feb 24, 2022
1f17aff
added template test with two parameters and new logic in the case the…
nbronn Feb 27, 2022
fb8ca5c
added two-parameter unit test and a check for overlapping parameters …
nbronn Mar 1, 2022
0ce2fa1
Merge branch 'main' of github.com:Qiskit/qiskit-terra into template-p…
nbronn Mar 1, 2022
9f59e06
Merge branch 'template-param-expression' of github.com:nbronn/qiskit-…
nbronn Mar 1, 2022
5de0384
remove ParameterTypeeException from exceptions.py
nbronn Mar 3, 2022
7906036
Restore lazy symengine imports
jakelishman Mar 24, 2022
092f92b
Rename to_sympify_expression to sympify
jakelishman Mar 24, 2022
95dbcfb
Revert now-unnecessary changes to calibration builder
jakelishman Mar 24, 2022
908f87d
Fixup release note
jakelishman Mar 24, 2022
fc83156
Add explicit tests of template matching pass
jakelishman Mar 24, 2022
a14dc37
Fix template parameter substitution
jakelishman Mar 24, 2022
9d07849
Merge remote-tracking branch 'ibm/main' into template-param-expression
jakelishman Mar 24, 2022
7034789
Fix overlooked documentation comment
jakelishman Mar 24, 2022
16bbffb
Remove qasm.pi import in favour of numpy
jakelishman Mar 24, 2022
317e2a6
Add tests of multi-parameter instructions
jakelishman Mar 24, 2022
6ccc663
Fix template matching with multiparameter expressions
jakelishman Mar 24, 2022
94e1884
Silence overzealous pylint warning
jakelishman Mar 24, 2022
87e5fe8
Merge remote-tracking branch 'ibm/main' into template-param-expression
jakelishman Mar 24, 2022
df9c3d3
Merge branch 'main' into template-param-expression
mergify[bot] Mar 28, 2022
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
15 changes: 14 additions & 1 deletion qiskit/circuit/parameterexpression.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from qiskit.circuit.exceptions import CircuitError
from qiskit.utils import optionals as _optionals


# This type is redefined at the bottom to insert the full reference to "ParameterExpression", so it
# can safely be used by runtime type-checkers like Sphinx. Mypy does not need this because it
# handles the references by static analysis.
Expand Down Expand Up @@ -522,6 +521,20 @@ def is_real(self):
return False
return True

def sympify(self):
"""Return symbolic expression as a raw Sympy or Symengine object.

Symengine is used preferentially; if both are available, the result will always be a
``symengine`` object. Symengine is a separate library but has integration with Sympy.

.. note::

This is for interoperability only. Qiskit will not accept or work with raw Sympy or
Symegine expressions in its parameters, because they do not contain the tracking
information used in circuit-parameter binding and assignment.
"""
return self._symbol_expr


# Redefine the type so external imports get an evaluated reference; Sphinx needs this to understand
# the type hints.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
Template matching substitution, given a list of maximal matches it substitutes
them in circuit and creates a new optimized dag version of the circuit.
"""
import collections
import copy
import itertools

from qiskit.circuit import ParameterExpression
from qiskit.circuit import Parameter, ParameterExpression
from qiskit.dagcircuit.dagcircuit import DAGCircuit
from qiskit.dagcircuit.dagdependency import DAGDependency
from qiskit.converters.dagdependency_to_dag import dagdependency_to_dag
Expand Down Expand Up @@ -175,7 +177,6 @@ def _rules(self, circuit_sublist, template_sublist, template_complement):
Returns:
bool: True if the match respects the given rule for replacement, False otherwise.
"""

if self._quantum_cost(template_sublist, template_complement):
for elem in circuit_sublist:
for config in self.substitution_list:
Expand Down Expand Up @@ -269,11 +270,6 @@ def _remove_impossible(self):
list_predecessors = []
remove_list = []

# First remove any scenarios that have parameters in the template.
for scenario in self.substitution_list:
if scenario.has_parameters():
remove_list.append(scenario)

# Initialize predecessors for each group of matches.
for scenario in self.substitution_list:
predecessors = set()
Expand Down Expand Up @@ -324,8 +320,7 @@ def _substitution(self):

# Fake bind any parameters in the template
template = self._attempt_bind(template_sublist, circuit_sublist)

if template is None:
if template is None or self._incr_num_parameters(template):
continue

template_list = range(0, self.template_dag_dep.size())
Expand Down Expand Up @@ -432,7 +427,6 @@ def run_dag_opt(self):
cargs = []
node = group.template_dag_dep.get_node(index)
inst = node.op.copy()

dag_dep_opt.add_op_node(inst.inverse(), qargs, cargs)

# Add the unmatched gates.
Expand Down Expand Up @@ -486,6 +480,11 @@ def _attempt_bind(self, template_sublist, circuit_sublist):
solution is found then the match is valid and the parameters
are assigned. If not, None is returned.

In order to resolve the conflict of the same parameter names in the
circuit and template, each variable in the template sublist is
re-assigned to a new dummy parameter with a completely separate name
if it clashes with one that exists in an input circuit.

Args:
template_sublist (list): part of the matched template.
circuit_sublist (list): part of the matched circuit.
Expand All @@ -499,51 +498,127 @@ def _attempt_bind(self, template_sublist, circuit_sublist):
from sympy.parsing.sympy_parser import parse_expr

circuit_params, template_params = [], []
# Set of all parameter names that are present in the circuits to be optimised.
circuit_params_set = set()

template_dag_dep = copy.deepcopy(self.template_dag_dep)

for idx, t_idx in enumerate(template_sublist):
# add parameters from circuit to circuit_params
for idx, _ in enumerate(template_sublist):
qc_idx = circuit_sublist[idx]
circuit_params += self.circuit_dag_dep.get_node(qc_idx).op.params
template_params += template_dag_dep.get_node(t_idx).op.params
parameters = self.circuit_dag_dep.get_node(qc_idx).op.params
circuit_params += parameters
for parameter in parameters:
if isinstance(parameter, ParameterExpression):
circuit_params_set.update(x.name for x in parameter.parameters)

_dummy_counter = itertools.count()

def dummy_parameter():
# Strictly not _guaranteed_ to avoid naming clashes, but if someone's calling their
# parameters this then that's their own fault.
return Parameter(f"_qiskit_template_dummy_{next(_dummy_counter)}")

# Substitutions for parameters that have clashing names between the input circuits and the
# defined templates.
template_clash_substitutions = collections.defaultdict(dummy_parameter)

# add parameters from template to template_params, replacing parameters with names that
# clash with those in the circuit.
for t_idx in template_sublist:
node = template_dag_dep.get_node(t_idx)
sub_node_params = []
for t_param_exp in node.op.params:
if isinstance(t_param_exp, ParameterExpression):
for t_param in t_param_exp.parameters:
if t_param.name in circuit_params_set:
new_param = template_clash_substitutions[t_param.name]
t_param_exp = t_param_exp.assign(t_param, new_param)
sub_node_params.append(t_param_exp)
template_params.append(t_param_exp)
node.op.params = sub_node_params

for node in template_dag_dep.get_nodes():
sub_node_params = []
for param_exp in node.op.params:
if isinstance(param_exp, ParameterExpression):
for param in param_exp.parameters:
if param.name in template_clash_substitutions:
param_exp = param_exp.assign(
param, template_clash_substitutions[param.name]
)
sub_node_params.append(param_exp)

node.op.params = sub_node_params

# Create the fake binding dict and check
equations, symbols, sol, fake_bind = [], set(), {}, {}
for t_idx, params in enumerate(template_params):
if isinstance(params, ParameterExpression):
equations.append(sym.Eq(parse_expr(str(params)), circuit_params[t_idx]))
for param in params.parameters:
symbols.add(param)

if not symbols:
equations, circ_dict, temp_symbols, sol, fake_bind = [], {}, {}, {}, {}
for circuit_param, template_param in zip(circuit_params, template_params):
if isinstance(template_param, ParameterExpression):
if isinstance(circuit_param, ParameterExpression):
circ_param_sym = circuit_param.sympify()
else:
circ_param_sym = parse_expr(str(circuit_param))
equations.append(sym.Eq(template_param.sympify(), circ_param_sym))

for param in template_param.parameters:
temp_symbols[param] = param.sympify()

if isinstance(circuit_param, ParameterExpression):
for param in circuit_param.parameters:
circ_dict[param] = param.sympify()
elif template_param != circuit_param:
# Both are numeric parameters, but aren't equal.
return None

if not temp_symbols:
return template_dag_dep

# Check compatibility by solving the resulting equation
sym_sol = sym.solve(equations)
sym_sol = sym.solve(equations, set(temp_symbols.values()))
jakelishman marked this conversation as resolved.
Show resolved Hide resolved
for key in sym_sol:
try:
sol[str(key)] = float(sym_sol[key])
sol[str(key)] = ParameterExpression(circ_dict, sym_sol[key])
except TypeError:
return None

if not sol:
return None

for param in symbols:
fake_bind[param] = sol[str(param)]
for key in temp_symbols:
fake_bind[key] = sol[str(key)]

for node in template_dag_dep.get_nodes():
bound_params = []

for param in node.op.params:
if isinstance(param, ParameterExpression):
try:
bound_params.append(float(param.bind(fake_bind)))
except KeyError:
return None
for param_exp in node.op.params:
if isinstance(param_exp, ParameterExpression):
for param in param_exp.parameters:
if param in fake_bind:
if fake_bind[param] not in bound_params:
param_exp = param_exp.assign(param, fake_bind[param])
else:
bound_params.append(param)
param_exp = float(param_exp)
bound_params.append(param_exp)

node.op.params = bound_params

return template_dag_dep

def _incr_num_parameters(self, template):
"""
Checks if template substitution would increase the number of
parameters in the circuit.
"""
template_params = set()
for param_list in (node.op.params for node in template.get_nodes()):
for param_exp in param_list:
if isinstance(param_exp, ParameterExpression):
template_params.update(param_exp.parameters)

circuit_params = set()
for param_list in (node.op.params for node in self.circuit_dag_dep.get_nodes()):
for param_exp in param_list:
if isinstance(param_exp, ParameterExpression):
circuit_params.update(param_exp.parameters)

return len(template_params) > len(circuit_params)
nbronn marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
features:
- |
The :class:`.ParameterExpression` class is now allowed in the
template optimization transpiler pass. An illustrative example
of using :class:`.Parameter`\s is the following:

.. code-block::

from qiskit import QuantumCircuit, transpile, schedule
from qiskit.circuit import Parameter

from qiskit.transpiler import PassManager
from qiskit.transpiler.passes import TemplateOptimization

# New contributions to the template optimization
from qiskit.transpiler.passes.calibration import RZXCalibrationBuilder, rzx_templates

from qiskit.test.mock import FakeCasablanca
backend = FakeCasablanca()

phi = Parameter('φ')

qc = QuantumCircuit(2)
qc.cx(0,1)
qc.p(2*phi, 1)
qc.cx(0,1)
print('Original circuit:')
print(qc)

pass_ = TemplateOptimization(**rzx_templates.rzx_templates(['zz2']))
qc_cz = PassManager(pass_).run(qc)
print('ZX based circuit:')
print(qc_cz)

# Add the calibrations
pass_ = RZXCalibrationBuilder(backend)
cal_qc = PassManager(pass_).run(qc_cz.bind_parameters({phi: 0.12}))

# Transpile to the backend basis gates
cal_qct = transpile(cal_qc, backend)
qct = transpile(qc.bind_parameters({phi: 0.12}), backend)

# Compare the schedule durations
print('Duration of schedule with the calibration:')
print(schedule(cal_qct, backend).duration)
print('Duration of standard with two CNOT gates:')
print(schedule(qct, backend).duration)

outputs

.. parsed-literal::

Original circuit:

q_0: ──■──────────────■──
┌─┴─┐┌────────┐┌─┴─┐
q_1: ┤ X ├┤ P(2*φ) ├┤ X ├
└───┘└────────┘└───┘
ZX based circuit:
┌─────────────┐ »
q_0: ────────────────────────────────────┤0 ├────────────»
┌──────────┐┌──────────┐┌──────────┐│ Rzx(2.0*φ) │┌──────────┐»
q_1: ┤ Rz(-π/2) ├┤ Rx(-π/2) ├┤ Rz(-π/2) ├┤1 ├┤ Rx(-2*φ) ├»
└──────────┘└──────────┘└──────────┘└─────────────┘└──────────┘»
«
«q_0: ────────────────────────────────────────────────
« ┌──────────┐┌──────────┐┌──────────┐┌──────────┐
«q_1: ┤ Rz(-π/2) ├┤ Rx(-π/2) ├┤ Rz(-π/2) ├┤ P(2.0*φ) ├
« └──────────┘└──────────┘└──────────┘└──────────┘
Duration of schedule with the calibration:
1600
Duration of standard with two CNOT gates:
6848
Loading