Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
) * added new equivalence rzx_zz4 * added another zz-ish template (looks for basis gates) * looking at adding additions to rzx templates * fixes parsing of Parameter name for sympy during template optimization * generalized fix for multiple parameters in an expression and constant parameters, removed some excess files from another branch * one more minor fix to bring inline with qiskit-terra main * trying to fix parameter parsing for template optimization * made sure floats were added correctly to (template) parameters * got template matching to work with floats, sympy still not understanding Parameters either in equations or symbols set in template_substitution.py * further modifications to accept circuit parameters for template optimization * debugging the binding of template parameters * realized I was not treating ParameterExpressions carefully and should lean on parse_expr from sympy to cast to symbols * converted all bindings to ParameterExpressions (via .assign()), set trace to fix template use with Parameters * cleaned up _attempt_bind routine * exploring overriding removing the matched scenarios with parameters * introduced a total hack for dealing with ParamterExpressions that contain floats for RXGates * (non-latex) parameters now currently working in template optimization transpilig step followed by parameter binding * cleaned up some whitespace and removed commented-out lines * cleaned up some tox/lint errors * removed unneccessary Parameter import * bypassed unit test test_unbound_parameters() and re-tox/lint * fixed one last linting issue * fixed cyclic import error * modified calibration_creator to accept a ParameterExpression containing a float * fixed an mismatch when trying to add calibrations and addressed a conversation in the PR * last tox/lint checks i'm sure ;) * now params comes from node_op argument * handling error in case gate parameters is empty in dagcircuit.py * Fix template matching for parameters with LaTeX name. * added missing docstring * removed pdb set_trace * made changes requested in PR 6899 * made changes requested in PR 6899 #2 * remembered to tighten try/except handling * finished making changes requested in PR 6899 * fixed remaining linting issue * added comment about templates working for parameterized RZXGates and RXGates * Fix test unbound parameters * Check if matrix with Parameter is unitary * Fix merge issue * removed real=True in two symbol Symbol expressions, which was messing up the solver for some reason. * generalized to iterate over parameters, and removed reference to private member * modified .get_sympy_expr() to use symengine if possible * made the negation of the RXGate() much less verbose * working thru tox/lint checks * added unit test test_unbound_parameters_in_rzx_templates to confirm template optimization handles template optimization with unbound parameters correctly * Fix unbund parameters test * fixed issue with adding calibrations without params * Add real=True to symbols * fixed linting issue * Fix for symengine * simplified the parameter handling for adding calibrations to gates * added a check for unitary on an arbitrary float in the case symengine is imported (and fixed a couple minor bugs) * Parammeter can be complex * fixed tox/lint issues * removed one more imposition of real parameters * one last linting issue * modified release notes * fixed some transpiler library imports that were out of date * added sphinx referencing to release notes and print statement for the case of testing unbound parameters when creating a unitary gate * fixed some tox/lint issues * Fix review issues * fixing last tox/lint issues * added release notes and fixed tox/lint issues * added method in template_substitution to compare the number of parameters in circuit with the that of the template that would potentially replace it * fixing up some template matching unit tests * fixed up template matching unit tests to remove calls to UnitaryGate * Update qiskit/dagcircuit/dagcircuit.py Co-authored-by: Jake Lishman <jake@binhbar.com> * Update qiskit/extensions/unitary.py Co-authored-by: Jake Lishman <jake@binhbar.com> * Update qiskit/extensions/unitary.py Co-authored-by: Jake Lishman <jake@binhbar.com> * added template test with two parameters and new logic in the case there are duplicate parameters in the circuit and template * added two-parameter unit test and a check for overlapping parameters between circuits and templates * remove ParameterTypeeException from exceptions.py * Restore lazy symengine imports Use of `_optionals.HAS_SYMENGINE` is intended to be within run-time locations; putting it at the top level of a file causes this fairly heavy library to be imported at runtime, slowing down `import qiskit` for those who won't use that functionality. * Rename to_sympify_expression to sympify * Revert now-unnecessary changes to calibration builder * Fixup release note * Add explicit tests of template matching pass This adds several tests of the exact form produced by running the template-matching transpiler pass, including those with purely numeric circuits and those with symbolic parameters. * Fix template parameter substitution This fixes issues introduced recently in the PR that caused parameters to be incorrectly bound in the result. This meant that the actual numbers in the produced circuits were incorrect. This happened mostly by tracking data structures being updated at the wrong levels within loops. In addition, this commit also updates some data structures to more robust and efficient versions: - Testing whether a parameter has a clash is best done by constructing a set of parameters used in the input circuits, then testing directly on this, rather than stringifying expressions and using subsearch matches; this avoids problems if two parameters have contained names, or if more than one match is catenated into a single string. - Using a dictionary with a missing-element constructor to build the replacement parameters allows the looping logic to be simpler; the "build missing element" logic can be separated out to happen automatically. * Fix overlooked documentation comment * Remove qasm.pi import in favour of numpy * Add tests of multi-parameter instructions * Fix template matching with multiparameter expressions * Silence overzealous pylint warning Co-authored-by: Rafał Pracht <rpracht@wp.pl> Co-authored-by: Rafał Pracht <55279376+rafal-pracht@users.noreply.github.com> Co-authored-by: Jake Lishman <jake@binhbar.com> Co-authored-by: Jake Lishman <jake.lishman@ibm.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information