Now that qiskit-terra 0.18.0 is out the door we should bump the version
string on master to show the source version we're installing is newer
than what's been released.
This commit fixes an issue with generating and loading QPY files with
complex instruction parameters (initialize) or blueprint circuits that
were in a circuit. Normally complex parameter types aren't valid on
gates or instructions, however initialize uses them as the statevector
elements are stored as the parameter list for the object (instead of as
a numpy array parameter like unitary). So to fix this we need to be able
to handle this edge case and save complex numbers for parameters too.
Similarly there was an issue found when trying to deserialize a blueprint
circuit object. It doesn't seem possible to reconstruct an instance of a
blueprint circuit reliably from just the parameters list for the
circuit. This causes an issue when deserializing as the gate
reconstructed from the qpy data is not valid. The only way to fix this
is to treat any blueprint circuit as a custom gate or instruction
instead of a discrete library element.
In case this merges after 0.18.0 and needs to be backported to 0.18.1
this is still a backwards compatible change from the QPY guarantee PoV.
While the complex parameter type wasn't present prior to this commit it
does not change the file format at all, and works with in the
constraints of QPY v1. Any QPY file generated with 0.18.0 will still be
loadable by 0.18.1 (assuming this commit is included in a 0.18.1
release). This is really just a bug fix because you could not generate a
QPY in 0.18.0 with initialize using complex parameters. It's also worth
pointing out from a compatibility PoV a QFT in a circuit would generate
a QPY file in 0.18.0 however this QPY file could never be loaded as we
can't create a QFT from what 0.18.0 stored in the qpy data.
Fixes#6710
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit updates the test_transpile_across_optimization_levels in the
TestParameters test class to leverage ddt instead of a for loop for
testing each optimization level. Right now we're hitting sporadic
failures in CI related to that test case and the only candidate for
causing a performance issue is only applicable to optimization level 3.
To get better data about the failure mode it is important to know which
optimization level a failure is occuring at. By using ddt and
parameterizing the test over each optimization level, each opt level
becomes a separate test method with a unique test id (which identifies
the optimization level) so we can easily verify if the failures only
occur at level 3 or not.
* Prepare 0.18.0 release
To prepare for the upcoming 0.18.0 release this commit moves all the
release notes into a 0.18 subdirectory to keep them separate from future
development notes post-release. It also adds a release note with the
prelude section providing the high level overview of the release. When
this merges it should be the commit used to tag the 0.18.0 release.
* Move new release note
* Start rewriting release notes
* More updates
* Fix RZXCalibrationBuilderNoEcho docs
* Fix formatting issue
* Update more release notes
* Finish first pass of feature release notes
* Apply suggestions from code review
Co-authored-by: Julien Gacon <gaconju@gmail.com>
* Finish first pass of upgrade and deprecation notes
* Start rewriting fix notes
* Remove accidentally committed file
* Update releasenotes/notes/0.18/prepare-0.18-9a0fb87005e314fd.yaml
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Remove 0.17.x stable release notes
* More fix note rewrites
* Move new release notes
* Move new release notes
* Add bip mapper extras to all extra
* Finish first pass of release notes
* Revert changes to tox.ini
* Move and rewrite new release notes
* Fix typos
* Fix another typo
* Remove new fix note as it only was an issue on unreleased code
* Apply suggestions from code review
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Expand prelude
* Fix alignment release note example
* Remove double requirement on tweedledum in ci
* Move and update new release notes
* Move new release notes
* Fix lint
* Move and update new release notes
* Apply suggestions from code review
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
* Move and update new release notes
* Apply suggestions from code review
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
* Update releasenotes/notes/0.18/TensoredMeasFitter-d327f0e2d736efdd.yaml
Co-authored-by: Julien Gacon <gaconju@gmail.com>
* Apply suggestions from code review
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
* Update alignment release note
* Remove release note that shouldn't be advertised yet
* Fix alignment pass release note
* Move and update the last release note
* Apply suggestions from code review
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
* pulse optimization for 3-cnot working
* 2 cnot effecient decomp working
* for pulse efficient ZSX decomp make sure all gates are in in basis
* make pulse optimal decomposition two-qubit direction aware.
On devices where the CNOT occurs with greater fidelity in one direction than the opposite direction, this PR does the decomposition two qubit pulse optimal decomposition in the way which improves fidelity.
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* minor typo
* tab
* black linting
* add tests for multiple registers, coupling_map.
Also adds index method to registers
* add swap to pulse optimal synthesis
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* fix bug synthesizing swap when it's in basis
* lint
* handle empty basis gates
* Pulse optimal decomposition is done if not specified
and raises an exception if requested but not possible.
Clean the syntax a bit.
Co-authored-by: Lev S. Bishop <18673315+levbishop@users.noreply.github.com>
* linting
* add xzx decomposition. Fix global phase.
* linting
* standard handling for circuit_xzx
* ci test to find mac/windows bug
* test
* test ci known decomp
* linting
* improve phase handling
* clean debug code. add tests.
* add release notes. add "synth_gates" option to unitary synthesis pass.
* linting
* linting, update docs
* missed global phase addition. linting. docstring.
* linting
* try to fix doc timeout
* add XZX to known ONE_QUBIT_EULER_BASIS_GATES
This makes the UnitarySynthesis and Optimize1qGatesDecomposition passes
aware of the xzx decomposition.
* resolved bug in natural_direction flag
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Fix test skip condition and lint
* increase size of qv circuit
* Update test/python/transpiler/test_unitary_synthesis.py
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* Update test/python/transpiler/test_unitary_synthesis.py
* Fix tests and lint
* remove register.index(). Cache indexing in test.
* linting
* add coupling_map to UnitarySynthesis in preset passmanagers.
* raise if non-optimal decomposition encountered and pulse_optimize=True
* fix optimization in special case of 3 cnot decomp.
* testing
* missed line
* linting
* catch another special case of decomp
* typo
* change logic in 2q decomp
* debug code
* more debug code
* global phase
* passing unix test
* linting
* test wrong comp
* linting
* revert qceuler
* update natural_direction documentation
* clean debug code
* formatting
* Revert "formatting"
This reverts commit 2d46f20b24.
* Revert "clean debug code"
This reverts commit a78d848dd0.
* fix flag
* correct global phase in a case
* clean debug code
* catch sign problem
* correct correction
* catch rounding error
* typo
* Update qiskit/transpiler/passes/synthesis/unitary_synthesis.py
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Update qiskit/transpiler/passes/synthesis/unitary_synthesis.py
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* Add backend properties to preset pass managers
* change internal "natural_direction" to "preferred_direction"
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
Co-authored-by: Lev S. Bishop <18673315+levbishop@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Networkx 2.6 released a few hours ago and is causing a version conflict
with the matplotlib version we install in the tutorials job. The version
we use in the tutorials job was specifically pinned because of
performance issues we were seeing with newer matplotlib releases
(admittedly a while ago) to side step the issue and get 0.18.0 out the
door this commit pins the networkx version we use in the constraints
file. After 0.18.0 releases we can investigate removing the matplotlib
pin in the tutorials job and this constraint.
This PR included a deprecation removal which was invalid as not enough
time has passed. The deprecation occured in 0.17.0 which is not eligible
for removal until the 0.19.0 release. This PR can be repropoposed after
0.18.0 is released and quickly merged into 0.19.0.
This reverts commit 09f9c10daa.
Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* fix wrong condition for checking root gates for qasm output
* verify support gate definitions with qelib1.inc in composite circuit output
* add a line break for self.qelib1_gate_names
* add definitions for children gates
* handle exception of instructions without definitions
* move exception handling to _get_composite_circuit_qasm_from_instruction
* generate instruction definitions after all undefinied instructions are identified
* insert gate definition before
* find all undefinied gates and add to the list
* correct C3XGate, C4XGate, RC3XGate, C3SXGate name to match qelib1.inc
* expilictly specify number of control qubits in mcx_gray, mcx_recursive, mcx_vchain
* expilictly specify number of control qubits in mcx_gray, mcx_recursive, mcx_vchain
* remove commented unused code
* recursive generation of composite gate qasm
* remove redundant newline for gate definitions
* add barrier, measure, reset to qelib1_gate_names
* resolve merge conflicts
* Revert "resolve merge conflicts"
This reverts commit f7516973cc.
* remove redundant code after merging
* append instruction id to make it unique for custom instructions that have same name as existing instruction
* use unitary gate definition string
* remove unitary gate definition output from unitary gate and incorprate directly in QuantumCircuit
* remove redundant unitary_gate list in QuantumCircuit.qasm
* modified tests to fit the current format of qasm definition string
* fix linter errors
* add test_circuit_qasm_with_mcx_gate
* add test_circuit_qasm_with_mcx_gate_variants
* add test_circuit_qasm_with_composite_circuit_with_children_composite_circuit
* rename c3sqrtx to c3sx
* black
* accept all incoming changes
* make self.qasm_string_temp a local variable instead of class property
* self.existing_composite_circuits a local variable
* remove self.qelib_gates and revert back to local existing_gate_names
* correct existing_composite_circuits to be empty list
* change _get_composite_circuit_qasm_from_instruction and _insert_composite_gate_definition_qasm to module level private function
* fix linter error
* rename qasm_string_temp back to string_temp
* add missing import for ControlledGate
* fix circular import issue with ControlledGate
* fix insert composite gate definition
* fix recursive generation of composite gate definition
* formating
* revert 2dd3d1983c
* black
* reduce diff
* reduce diff
* import
* even small footprint
* Update qiskit/circuit/quantumcircuit.py
* replace nested conditionals
* match existing_gate_names with qelib1.inc from paper
* remove import qiskit
* Revert "match existing_gate_names with qelib1.inc from paper"
This reverts commit e27f162ec6.
* update test_qasm_unitary_twice and test_qasm_2q_unitary expected qasm output to match qc.qasm() method
* tensor in place
* restore x.py
* modify test_circuit_qasm_with_mcx_gate to match issue 4943 test case
* match expected qasm output in test_circuit_qasm_with_mcx_gate_variants without changing names
* remove print
* restore qelib1.inc from main branch
* restore lexer.py from main branch
* black
* restore unitary.py mat and cmat
* add release note
* lint
* unused import
* black
* seperate _add_to_existing_composite_circuits function from _get_composite_circuit_qasm_from_instruction
* clean up and rename to _add_sub_instruction_to_existing_composite_circuits
* fix typo
parant->parent
* fix lint & test
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* add more docstring
* rewording
* Update qiskit/transpiler/passes/scheduling/instruction_alignment.py
Co-authored-by: Thomas Alexander <thomasalexander2718@gmail.com>
* Update qiskit/transpiler/passes/scheduling/instruction_alignment.py
Co-authored-by: Thomas Alexander <thomasalexander2718@gmail.com>
* lint
* minor change to trigger CI
* minor change to trigger CI
* Update qiskit/transpiler/passes/scheduling/instruction_alignment.py
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* Update qiskit/transpiler/passes/scheduling/instruction_alignment.py
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* add documentation for alignment
* fix error
* Fix link sphinx syntax
Co-authored-by: Thomas Alexander <thomasalexander2718@gmail.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Fix support for standalone registers in qpy format
This commit tweaks the qpy register format slightly to enable
differentiating between standalone registers (ones that own their bits)
and registers that contain pre-existing bits. Previously this didn't
work in all cases with standalone registers (it only worked assuming
the qubits in a register were a contiguous set of qubit indices in the
circuit). Normally this type of change would require a format version
bump for backwards compatibility (see #6419 for a PoC showing this)
however because we have yet to include qpy in a release we have an
opportunity to fix this prior to release in the same initial version.
* Fix sphinx syntax
* Fix docstring whitespace
* Fix rebase error
* Update qiskit/circuit/qpy_serialization.py
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
* Expand docstring
* Fix bugs and expand tests
* Add mixed standalone shared register circuit test
In the process of adding this test a bug was found in the DAGCircuit
__eq__ method (which is used for QuantumCircuit too). The equality of
circuits was failing based on the insertion order of registers which
doesn't matter. As long as the bit indices are in order in the register
(ie qr[2] -> 3 is consistent between both circuits) the order qr was
inserted into the circuit doesn't matter. This was causing a failure in
the new test because qpy deserialization always loads standalone
registers first even though the bit order is properly preserved. To fix
this the dagcircuit __eq__ method is update to only care about the bit
indices (both register and circuit) and ignore register insertion order.
* Add comments on the read register flow
* Preserve register insertion order on circuit deserialization
This commit preserves the register insertion order when deserializing a
circuit form qpy. Previously this wasn't being preserved and standalone
registers were always being added first. This also reverts the change
made to dagcircuit.__eq__ made in an earlier commit to workaround the
earlier limitation.
* Handle out of order register bit insertion
* Fix endianness bug in register index array
* Preserve the label for instructions
This commit modifies the instruction payload format to also include the
label of an instruction in the circuit. Previously we were just ignoring
the label which meant that it was omitted from the qpy data and any
labels would not be present in the deserialized circuit.
* Fix duplicate test_name
* Fix lint
* Assert label equality in label tests
* Fix label init condition
* Remove unecessary condition
* Deduplicate register creation
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
* start wrapping all plain QC library circuits
* fix more tests
* fix phase estimation test on QFT reverse bits
* black
* name QFT uppercase
* final test fixes
* GroverOp includes the global phase in inner circuit, don't add it to outer circuit
* Make sure ``unitary`` input to PhaseEstimation is a gate and not instruction
* wrap nlocal circuits
* blueprint circuits
* fix gradient tests
* wrap circuit library newcomers
* missing inner name in grover op
* wrap evolved op ansatz + QAOA
* fix qaoa tests
* rename inner->circuit
* add reno
* black
* fix 1q optimization heuristic
* drop unnecessary brackets
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* actually fill out reno template :P
* maker linter happier
* make lev happier
* add a GH link to the sloppy synth warning
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* improve source linking in changelog
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* remember target basis name
* update circuit definitions
* improve linter cheerfulness
* increase reluctance to decompose calibrated gates
* change .basis slot to ._decomposers
* my local linter thinks everything is fine :/
* add some U3 special cases
* make black happy
* fix a claimed circular import
* add a couple more rewrite tests
* satisfy black
* avoid lambda = ± pi in 1Q KAK
* optimize on strict length
* more thorough gate elision during 1Q synthesis
* respond to most of Lev's feedback
* add an 'allow_non_canonical' parameters
* normalize K rolls
* Update qiskit/quantum_info/synthesis/one_qubit_decompose.py
Co-authored-by: Lev Bishop <18673315+levbishop@users.noreply.github.com>
* Update qiskit/quantum_info/synthesis/one_qubit_decompose.py
Co-authored-by: Lev Bishop <18673315+levbishop@users.noreply.github.com>
* add some Euler special case tests for pushing a K(pi) through an A(alpha)
* add some Euler special case tests for pushing a K(pi) through an A(alpha)
* Update one_qubit_decompose.py
a by-hand attempt at reformatting the docstring
* ok linter
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Lev Bishop <18673315+levbishop@users.noreply.github.com>
* Fix docstring of assign_parameters
and remove the deprecated arguments, as they have been deprecated > 3months ago
* add reno
* lint
* lint
* lint!
Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Since this #6534 merged we've seen a spike in test failures with
test_transpile_across_optimization levels where the transpile fails to
stabilize on a fixed depth. While we haven't confirmed the root cause of
the failure to be #6534 given the proximity to the release, the relative
timing adds up. The performance improvement the PR made was good, but
not critical as collect_2q_blocks is hardly ever a bottleneck. Given the
proximity to the 0.18.0 release this commit reverts #6534 to try and
relieve pressure on CI. We can reinvestigate adding this back after the
0.18.0 release.
The test that is failing is being improved in #6685 to isolate the test
methods to one for each optimization level. This will hopefully let us
debug the failure more easily when we re-apply #6534
This reverts commit 3bb72d340f.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* add DD pass
Co-authored-by: Lauren Capelluto <lcapelluto@users.noreply.github.com>
* docstrings + use dag._copy_circuit_metadata
* move pass under passes/scheduling
* add test
* add balanced spacing of pulses
* reno
* add XY4 test
* lint
* review comments
* duration and unit updated with the rest of dag metadata
* lint
* Update qiskit/transpiler/passes/scheduling/dynamical_decoupling.py
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* add circuits diagrams to test docstrings
* fix equiv check
* add spacing option
* add example of unbalanced spacing
* rebase
* Update qiskit/transpiler/passes/scheduling/dynamical_decoupling.py
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* add another example to docstring
* matt review
* lint
* fix docs
* last review
Co-authored-by: Lauren Capelluto <lcapelluto@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* pulse (transforms): fix pad() docstring formatting
The code sections were extending past ``Delay`` when viewed on the
Qiskit documentation website.
* pulse: fix utilities example
Didn't print the number of qubits at all, as it was clearly designed to.
* pulse (ScheduleBlock): format class docstring
Alignment contexts were not displaying as unique list items, due to
malformatted leading whitespace (leading whitespace for RST lists
should start at the same character as the start of the first list item
line).
* pulse (ScheduleBlock): format class docstring
Fix issues with RST not interpreting the end of interpreted blocks,
and a minor typo.
Co-authored-by: Thomas Alexander <thomasalexander2718@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* serialize (most) optimizers + test
* reduce duplicated code
* support any iterator in serialization
by converting the learning rates to arrays. This also means we don't need an additional module for iteratos
* test iterators being arrays
* serialize rest of the optimizers
* add reno
* fix lint
* missed return type
* lint
* move from_dict to Optimizer only
* add more tests
- on invalid names
- on initializing QNSPSA w/o "fidelity"
* rename to_dict to settings
and move all the construction logic to Optimizer.from_dict
* fix tests & lint
* try fixing tests
* lint!
* rm name from settings
* include callback & lse_solver in settings
* forgot to black
* update docstring & reno
* fix lint
* add safeguard to GSLS settings
* don't deprecate setting for now
* implement settings for nlopts
* don't make settings abstract
for bkwd compat
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Make tweedledum a hard requirement
This commit switches the tweedledum requirement from being optional to a
hard requirement for installing qiskit-terra. We rely on tweedledum to
synthesize phase oracles which is commonly used functionality and several
issues have been opened. This use of tweedledum will likely continue to
grow so we should just list it as a requirement moving forward.
We originally made it optional because the functionality depending on
tweedledum was isolated to just the classical function compiler which
wasn't widely used. There were also packaging issues in the past where
the available precompiled binaries for tweedledum didn't support all of
our supported environments, but those have been resolved. There is still
an issue for arm64 macOS binaries but Qiskit doesn't have wide support
for that yet (although there is a job for terra).
At the same time this commit cleans up the optional requirements list
so that aer is no longer listed there and we add an 'all' extra so that
people can have a simple entypoint to install all the optional extras at
once.
Fixes#6333FixesQiskit/qiskit#1253
* Remove unused imports
* Cleanup docstrings
* black setup
* Update requirements.txt
Co-authored-by: Bruno Schmitt <bruno.schmitt@epfl.ch>
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Bruno Schmitt <bruno.schmitt@epfl.ch>
* Fixed num_connected_components
* Added tests and reno
* Fixed num_conn_comp for bit cond with tests.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
* wip: initial move
* fix a bug when no coupling_map is supplied
* Improved documentation and parameter settings
* Improved logical/physical qubit mapping
* Better handling of measurements and final layout
* minor fixes
* add unit tests
* wip: start refactoring
* improve layout handling
* simplify dag construction and fix to output all ops
* fix to work with ApplyLayout
* focus on layout+routing
* improve how to call MIPMapping
* simplify the spec
* add an error handling
* fix how to call MIPMapping pass
* update user warning for change of given layout
* wip: refactor mip model
* improve top-level interface
* return original dag if fails to solve MIP
* minor fixes
* care the case no cplex is installed
* fix not to ignore swaps in original layers
* fix mismatch in layer and su4layer indices
* simplify by focusing only on depth objective
* rename MIP to BIP
* lint
lint
lint
lint
* improve interface around dummy steps
* improve error message when cplex fails
* restore level3 preset passmanager
* improve depth objective
* Rework optional dependency and add test configuration
This commit reworks the logic around the optional dependency on cplex.
The pass despite raising an exception if cplex wasn't installed was
unconditionally trying to import cplex from the model module at import
time. To avoid failures from that this adds a try block around the
actual cplex usage in the model module and exports whether it's
available or not. At the same time this is leveraged to add a skip
condition on the tests so we only run them if cplex is installed. Then
to run tests in CI we install cplex in the linux 3.7 job so we at least
run it in one environment. It's not available in all our supported
environments so getting full coverage in every env is not worth trying
for, so just testing the qiskit portion works is enough.
* Fix lint
* Fix test, lint and logging
* Fix lint and test, update docstring
* Fix docstring and improve performance taking the risk of failing to map
* Update docstring
* Replace cplex.Cplex with docplex.mp.model.Model to improve readability
Replace cplex.Cplex with docplex.mp.model.Model to improve readability
fix requiring docplex version
move docplex to requirements-dev
* Improve BIPMappingModel interface
simplify and improve docstring
Improve BIPMappingModel interface
* Update qiskit/transpiler/passes/routing/algorithms/bip_model.py
Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
* Fix docplex dependency
* fix unnecessary-comprehension
* lint
* lint
* update how to set cplex params and remove redundant constraints
* skip unless docplex
* fix a bug in arg threads
* remove python version restriction
* Change spec to require the number of virtual and physical qubits are the same
* Update to use 'requires' to require precondition passes
* Update qiskit/transpiler/passes/routing/algorithms/bip_model.py
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
* lint
* Add release note
Add release note
fix typos
* Update docstring
Update docstring
fix typo
* Improve error handling
* Change to return mapped dag for circuits with only 1q-gates
* Revert the spec change in the case of only 1q-gates
* Update releasenotes/notes/add-bip-mapper-f729f2c5672d7f3e.yaml
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Update releasenotes/notes/add-bip-mapper-f729f2c5672d7f3e.yaml
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Update qiskit/transpiler/passes/routing/bip_mapping.py
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Update qiskit/transpiler/passes/routing/bip_mapping.py
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Update qiskit/transpiler/passes/routing/bip_mapping.py
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* Update qiskit/transpiler/passes/routing/bip_mapping.py
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
Co-authored-by: Giacomo Nannicini <gnannicini@users.noreply.github.com>
Co-authored-by: Giacomo Nannicini <giacomo.n@gmail.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Fixed issue 6623 by raising errors for negative delay durations
* Fixed issue 6623 by raising errors for negative delay durations
* Updated solution to issue 6623 to raise errors for negative bound parameters and added test cases
* Fixed issue 6623 by raising errors for negative Delay gate durations, and adding appropriate test cases to test_delay.py
* Added tests
Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Add string parameter handling to QPY
This commit adds string parameter handling to the qpy serialization
format. The PauliGate generalized gate class uses pauli strings as a
parameter to the constructor. If there was a PauliGate in the circuit
the qpy serialization would fail because the string parameters weren't
handled. This commit fixes that by adding string as an allowed type for
qpy parameters.
To fix the reported issue of PauliGate serialization with qpy though the
PauliGate class needs to be exported in the __init__.py for the
qiskit.circuit.library path. Without this qpy doesn't know about the
special PauliGate constructor that allows strings and tries to treat it
as a normal custom gate which will fail when trying to create it with a
string parameter.
Fixes#6660
* Update qiskit/circuit/qpy_serialization.py
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
* Add PauliList class
* Fix some rebase errors
* Start adding tests
Co-authored-by: ikkoham <ikkoham@users.noreply.github.com>
* Complete test of PauliList
* Fix type in random_pauli_list
* add from_symplectic and docs
* fix lint and add test for random_pauli_list
* reflect the review
* Add release note
* fix evolve_clifford
* add more test cases
Co-authored-by: ikkoham <ikkoham@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
This commit removes the unused Make.bat file. This file was originally
added to provide a similar entrypoint to the makefile for windows users
that do not have automake installed. However, it hasn't really been
updated in some time and also has many issues in (like missing targets
and a hard dependency on conda). Since it clearly isn't used and hasn't
been updated this commit just removes the script. Using tox is a much
more viable solution for windows developers that do not have automake
as it handles everything this script was trying to do but is up to date
and works with any python env.
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
This commit fixes an issue in a couple of transpiler passes where a
multiqubit gate on >2 qubits that has a custom calibration. When a gate
has a calibration it should mostly be treated as a black box because the
pulse definition is passed directly to the backend for that gate.
However, previously for passes that worked on gates > 2 qubits weren't
correctly handling this which would result in an error. This has been
fixed so that if a multiqubit gate is in a circuit with a calibration
set it will be left as a black box and passed directly to the backend.
Fixes#6572
* This pass can collect block in a single sweep.
There is no need to mark nodes as seen nor to visit successor and
predecessors to collect the blocks. This commit significantly improves
performance. (IMHO it also greatly simplifies the implementation)
* Remove unnecessary 'continue' after if/else
* Update doc and remove useless test
* Update doc
* Update qiskit/transpiler/passes/optimization/collect_2q_blocks.py
Co-authored-by: georgios-ts <45130028+georgios-ts@users.noreply.github.com>
Co-authored-by: georgios-ts <45130028+georgios-ts@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Initial move get_gate_ctrl_text to utils
* Add get_gate_ctrl_text to mpl and text
* Update text drawer labels
* Finish text selection and first mathrm try on mpl
* Modify json style files to match default and testing
* Fix text tests 1
* Final testing and cleanup
* Moved param parsing to utils.py for 3 drawers
* Adjust param display
* Update ndigits to current defaults in get_param_str
* Fix mathrms and update style docs
* Fix image refs
* Add user name formatting to mpl and latex drawers
* Lint
* Update more references
* Add user name and label color selection
* Comments and doc
* Fix merge conflicts and testing
* Remove import copy from qcstyle
* Fix Boolean name in latex
* Add BooleanExpression test
* Fix math mode minus
* Test utils merge
* Format all visualization
* Three reformats
* Fix fmt off for black
* Lint
* Update ref images
* Fix wide_params and json files
* Update ref images
* Update 2 latex refs
* Lint
* Added release note
* Updated text drawer and tests for first letter caps
* Lint
* Fix color issue
* Add user label displaytext and displaycolor to user_style image
* Fix text drawer tests after main merge
* Unused imports
* Change op/instruction to node is 3 drawers
* Lint
* Update some docs
* Add some f-strings
* Lint
* Start merge conflict resolution
* Update latex ref files
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Add option to sort by values to plot_histogram
This commit adds new sorting options for the sort kwarg to the
plot_histogram function, 'value' and 'value_desc', to adjust the order
of the x axis based on the counts for a particular bitstring.
Fixes#6591
* Use max instead of sum
* Run black
* Add release note
* Update docstring
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>