* limit in the solver
* cleaning up
* lint
* add no limit for call_limit=None
* add time limit
* adding reason to stop
* but on reason
* limit tests
* remove qasm
* docstring
* Update qiskit/transpiler/passes/mapping/csp_layout.py
Co-Authored-By: Kevin Krsulich <kevin@krsulich.net>
* rename the property CSP_stop_reason
* release notes
* Add python 3.8 support and deprecate python 3.5
This commit adds support for running terra under python 3.8. It does
this by adding the trove classifiers to the package metadata and adding
a test job for python 3.8 (only travis for now this can be expanded in
the future when azure pipelines adds it to their image). At the same
time this commit starts the deprecation window for python 3.5. Python
3.5 goes end of life by upstream python in Sept. 2020. We should give
our users running with python 3.5 (which is about 10% of our users based
on pypi data) fair notice that when upstream python stops supporting it
we do as well.
* Fix lint
* Add back empty cache detection
As part of the refactors the empty stestr timing cache removal code was
removed from the travis config, but the cache wasn't removed. Adding the
python 3.8 job causes a failure because travis has no cached timing data
but still creates the empty directory which triggers
mtreinish/stestr#266. This adds back the empty cache removal to
workaround it so we can use the timing data for scheduling in future
runs.
* Add azure-pipelines python 3.8 jobs too
* Fix python 3.8 dictionary keys changed error
Starting in python 3.8 a new RuntimeError is raised, RuntimeError:
dictionary keys changed during iteration. This is caused by modifying an
iterator while looping over it. We were doing that in the
optimize_swap_before_measure pass. This commit fixes this by wrapping
the iterator in list() to make a copy of it for looping. This way we
don't modify the contents of what we're iterating over in the pass.
* Revert "Add azure-pipelines python 3.8 jobs too"
The missing matplotlib wheels are blockers for windows and osx
environment. Since we do not have the necessary dependencies installed
in those ci envs to compile matplotlib from source. We'll rely on just
travis for 3.8 testing until the matplotlib 3.2.0 release is pushed so
we don't have to compile it.
This reverts commit 40157621b1.
* Add skip for failing matplotlib test
The image comparison tests which are quite flaky are failing with
matplotlib compiled on 3.8. Looking at the image output from these
failures are very subtle (looks like resolution differences) again
questioning the value of these tests. This commit just skips the test
that is failing here to unblock the PR.
* Add azure 3.8 test jobs
* Pin to pre-release mpl for python 3.8
* Add spawn guard for python3.8 osx in examples
When running examples with execute, transpile, or any other calls using
parallel_map() the new default for spawn instead of fork requires that
scripts have a __name__ == "__main__" check in them to function
properly. If not calls to parallel_map fail errors around the
bootstrapping phase. To avoid this in the ci jobs this commit adds the
necessary checks to the example scripts we run in ci as part of
test_examples.
* Remove cryptography pin from constraints file
We pinned the cryptography package version back during the cryptography
2.6 release which broke our ci. It was a temporary step to avoid a
packaging issue in CI that was blocking development. However, when the
issue was resolved we never circled back to fix the issue. Now trying to
enable python 3.8 support to terra cryptography >=2.8 is needed for
python 3.8 on windows (to get a precompiled binary). This commit removes
the unecessary pin to unblock windows 3.8 ci.
* Bump cibuildwheel version to build 3.8 wheels
cibuildwheel 1.0.0 was released in early November [1] and added support
for building python 3.8 wheels. This commit bumps the cibuildwheel
version we use in the wheel build jobs at release time to also build 3.8
wheels for upload to pypi.
* Add skip and release note about macos py38 issues
This commit adds a skip for the failing python 3.8 test on osx and
windows so that we don't block everything over a small issue in the
tests. It also add a release note documenting the limitation with python
3.8 on macos with regardess to parallel_map/multiprocessing. Since this
limitation is new for this release (being the first release with python
3.8 support) we should document it as a known issue in the release
notes, especially since it likely won't be resolved until a python 3.8.1
release.
* Revert "Add spawn guard for python3.8 osx in examples"
While we can fix the tests to work on osx python3.8 by adjusting the
example scripts to only call functions using parallel_map from inside a
block run via if __name__ == '__main__': this unecessarily changes the
scripts for the quirks of a single environment. This commit reverts the
example scripts back to their original form and instead just skips the
unittest that executes them on python 3.8 macOS. We already have
documented this limitation in the release notes. When/if we have an
alternative solution for how we launch additional processes in python
3.8 on macOS that does not require this workaround we can look at
removing the skip.
This reverts commit 76ae197631.
* Apply suggestions from code review
Co-Authored-By: Kevin Krsulich <kevin@krsulich.net>
* Add helpful methods to defaults. methods previously existed in cmddef. still TODO: replace_pulse and TESTS
Add tests and bonus backend.version() to match backend.name()
Implement replace_pulse. Add more tests. Fixup style.
Add back build_cmd_defaults with deprecation warning. Make qubit/meas_freq_est a list attribute again, and handle related dependencies in assemble.
The example json was incorrect: the acquire commands did not have all the values required to be valid
Ops order isn't meaningful, test same keys instead
Add type hints to file
Fix#2955: improved error messaging for CmdDef
Update __str__ method, fix style
Move replace pulse feature to different branch. Also move base backend work.
Add release notes
Fix bug in assembler due to inconsistent units
Change inputs to assembler tests
Fixup issues in frequency units in assemble and assemble tests. They are still in GHz
Suppress warnings during assemble
Use module name to resolve name conflict between qiskit.validation.fields.List and typing.List
Rename op_qubits to qubits_with_op. Move _to_tuple out of util. Remove unnecessary attributes.
Respond to CR by Naoki
remove deprecation warnings
Remove filterwarnings and fixup repr
* Separate InstructionScheduleMap, give it such a name, give it the ops_def attribute for access. repr->str.
* Fixup rebase error
* Fix tests, fix style
* Improve class initialization. Fix bug where qubit ops wasn't being updated
* Remove outdated raises documentation and unused import
* Remove warning on redefinition
* Fix up removing operations or qubits, raise error if qubits or op are not found, fill in str test
* Rename op/operation to inst/instruction
* Move map to pulse
* Update release note, final style fix
* Add deprecation warning to the CmdDef.
* Added InstructionScheduleMap tests.
* modify instruction schedule to no longer be mutable objects used by internal representation.
* Revert cmd_def changes.
* instruction scheduler map linting.
* Final tests fixup
* rename duplicate test name
* Remove copy, simplify qubit_insts
* rename qubit_insts to qubit_instructions
* rename qubits_with_inst to qubits_with_instruction
* Update qiskit/pulse/instruction_schedule_map.py
* Update qiskit/pulse/instruction_schedule_map.py
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* linting.
* more linting.
* Add to_dict schema validation tests for assembler.
* Fixed bug where enums repr was being stored in to_dict.
* linting.
* Add helpful methods to defaults. methods previously existed in cmddef. still TODO: replace_pulse and TESTS
Add tests and bonus backend.version() to match backend.name()
Implement replace_pulse. Add more tests. Fixup style.
Add back build_cmd_defaults with deprecation warning. Make qubit/meas_freq_est a list attribute again, and handle related dependencies in assemble.
The example json was incorrect: the acquire commands did not have all the values required to be valid
Ops order isn't meaningful, test same keys instead
Add type hints to file
Fix#2955: improved error messaging for CmdDef
Update __str__ method, fix style
Move replace pulse feature to different branch. Also move base backend work.
Add release notes
Fix bug in assembler due to inconsistent units
Change inputs to assembler tests
Fixup issues in frequency units in assemble and assemble tests. They are still in GHz
Suppress warnings during assemble
Use module name to resolve name conflict between qiskit.validation.fields.List and typing.List
Rename op_qubits to qubits_with_op. Move _to_tuple out of util. Remove unnecessary attributes.
Respond to CR by Naoki
remove deprecation warnings
Remove filterwarnings and fixup repr
* Separate InstructionScheduleMap, give it such a name, give it the ops_def attribute for access. repr->str.
* Fixup rebase error
* Fix tests, fix style
* Improve class initialization. Fix bug where qubit ops wasn't being updated
* Remove outdated raises documentation and unused import
* Remove warning on redefinition
* Fix up removing operations or qubits, raise error if qubits or op are not found, fill in str test
* Rename op/operation to inst/instruction
* Move map to pulse
* Update release note, final style fix
* Add deprecation warning to the CmdDef.
* Added InstructionScheduleMap tests.
* modify instruction schedule to no longer be mutable objects used by internal representation.
* Revert cmd_def changes.
* instruction scheduler map linting.
* Final tests fixup
* rename duplicate test name
* Remove copy, simplify qubit_insts
* rename qubit_insts to qubit_instructions
* rename qubits_with_inst to qubits_with_instruction
* Update qiskit/pulse/instruction_schedule_map.py
* Update qiskit/pulse/instruction_schedule_map.py
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* linting.
* more linting.
* Switched cmd_def scheduluer tests to instruction_map and added cmd_def tests to eventually deprecated.
* Renamed InstructionScheduleMap to be InstructionScheduleMapping to be more pythonic and grammatically correct.
* name InstructionScheduleMapping to InstructionScheduleMap and defaults.instruction_schedulues to defaults.circuit_instruction_map
* fix scheduluer test.
* linting fix.
* Deprecate CmdDef in favor of PulseDefaults and migrate tests elsewhere to use defaults
* Update renamed attribute
In recent revisions to PulseDefaults the instruction_schedules attribute
has been renamed circuit_instruction_map. This commit updates outdated
references to the old revision.
* Update deprecation warning too
* Add release note
Fixes:
Fixes#2955 (improved error message for CmdDef.get)
Fixes#2861 (improved repr and str for CmdDef)
Changes:
qubit_freq_est and meas_freq_est now return frequency in Hz. (no warnings)
Replacing CmdDef
CmdDef will be deprecated following this PR. All existing methods are supported by
InstructionScheduleMap (via defaults().ops_def rather than .from_defaults()) with the
following exceptions:
- __init__ should be blank unless provided by the PulseDefaults object being initialized
- add should be used instead of init args by the user
- cmds and cmd_qubits are included with a deprecation message to use ops and
qubits_with_op instead.
New (not in CmdDef):
- qubit_ops(qubits): Return the operations that are defined for the qubit(s)
- assert_has(operation, qubits): Raise a PulseError if the op isn't defined
- remove(operation, qubits)
* Add helpful methods to defaults. methods previously existed in cmddef. still TODO: replace_pulse and TESTS
Add tests and bonus backend.version() to match backend.name()
Implement replace_pulse. Add more tests. Fixup style.
Add back build_cmd_defaults with deprecation warning. Make qubit/meas_freq_est a list attribute again, and handle related dependencies in assemble.
The example json was incorrect: the acquire commands did not have all the values required to be valid
Ops order isn't meaningful, test same keys instead
Add type hints to file
Fix#2955: improved error messaging for CmdDef
Update __str__ method, fix style
Move replace pulse feature to different branch. Also move base backend work.
Add release notes
Fix bug in assembler due to inconsistent units
Change inputs to assembler tests
Fixup issues in frequency units in assemble and assemble tests. They are still in GHz
Suppress warnings during assemble
Use module name to resolve name conflict between qiskit.validation.fields.List and typing.List
Rename op_qubits to qubits_with_op. Move _to_tuple out of util. Remove unnecessary attributes.
Respond to CR by Naoki
remove deprecation warnings
Remove filterwarnings and fixup repr
* Separate InstructionScheduleMap, give it such a name, give it the ops_def attribute for access. repr->str.
* Fixup rebase error
* Fix tests, fix style
* Improve class initialization. Fix bug where qubit ops wasn't being updated
* Remove outdated raises documentation and unused import
* Remove warning on redefinition
* Fix up removing operations or qubits, raise error if qubits or op are not found, fill in str test
* Rename op/operation to inst/instruction
* Move map to pulse
* Update release note, final style fix
* Add deprecation warning to the CmdDef.
* Added InstructionScheduleMap tests.
* modify instruction schedule to no longer be mutable objects used by internal representation.
* Revert cmd_def changes.
* instruction scheduler map linting.
* Final tests fixup
* rename duplicate test name
* Remove copy, simplify qubit_insts
* rename qubit_insts to qubit_instructions
* rename qubits_with_inst to qubits_with_instruction
* Update qiskit/pulse/instruction_schedule_map.py
* Update qiskit/pulse/instruction_schedule_map.py
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* linting.
* more linting.
* Add to_dict schema validation tests for assembler.
* Fixed bug where enums repr was being stored in to_dict.
* linting.
* Add helpful methods to defaults. methods previously existed in cmddef. still TODO: replace_pulse and TESTS
Add tests and bonus backend.version() to match backend.name()
Implement replace_pulse. Add more tests. Fixup style.
Add back build_cmd_defaults with deprecation warning. Make qubit/meas_freq_est a list attribute again, and handle related dependencies in assemble.
The example json was incorrect: the acquire commands did not have all the values required to be valid
Ops order isn't meaningful, test same keys instead
Add type hints to file
Fix#2955: improved error messaging for CmdDef
Update __str__ method, fix style
Move replace pulse feature to different branch. Also move base backend work.
Add release notes
Fix bug in assembler due to inconsistent units
Change inputs to assembler tests
Fixup issues in frequency units in assemble and assemble tests. They are still in GHz
Suppress warnings during assemble
Use module name to resolve name conflict between qiskit.validation.fields.List and typing.List
Rename op_qubits to qubits_with_op. Move _to_tuple out of util. Remove unnecessary attributes.
Respond to CR by Naoki
remove deprecation warnings
Remove filterwarnings and fixup repr
* Separate InstructionScheduleMap, give it such a name, give it the ops_def attribute for access. repr->str.
* Fixup rebase error
* Fix tests, fix style
* Improve class initialization. Fix bug where qubit ops wasn't being updated
* Remove outdated raises documentation and unused import
* Remove warning on redefinition
* Fix up removing operations or qubits, raise error if qubits or op are not found, fill in str test
* Rename op/operation to inst/instruction
* Move map to pulse
* Update release note, final style fix
* Add deprecation warning to the CmdDef.
* Added InstructionScheduleMap tests.
* modify instruction schedule to no longer be mutable objects used by internal representation.
* Revert cmd_def changes.
* instruction scheduler map linting.
* Final tests fixup
* rename duplicate test name
* Remove copy, simplify qubit_insts
* rename qubit_insts to qubit_instructions
* rename qubits_with_inst to qubits_with_instruction
* Update qiskit/pulse/instruction_schedule_map.py
* Update qiskit/pulse/instruction_schedule_map.py
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* linting.
* more linting.
* Switched cmd_def scheduluer tests to instruction_map and added cmd_def tests to eventually deprecated.
* Renamed InstructionScheduleMap to be InstructionScheduleMapping to be more pythonic and grammatically correct.
* name InstructionScheduleMapping to InstructionScheduleMap and defaults.instruction_schedulues to defaults.circuit_instruction_map
* fix scheduluer test.
* linting fix.
* fix MeasureChannel
* fix bug
* fix bug in bug
* Fix MemorySlots
* tweaking
* Fix typo
* Update the condition
This commit intends to change the idea of raising Pulse error when the length of mem_slots and acquires are not equal. The main idea of this PR is to output the user only those channels and memory slots that the user used.
* Revert "Update the condition"
This reverts commit 0b14dbd4b7.
* Cleaning up
* Fix typo
* tweaking m_slots
* Refactoring the logic
* Remove ipdb
* Added tests
* Fixed review suggestions
* Add docstring to test
* release notes
* typo
* Fix review suggestions
* fix release notes
* Adding more tests
* Fix Lint
* fix typo in test
* remove ipdb
* test test
* tweaking test
* lint
* fix review suggestions
* Remove assert (PR #225)
* avoid shift and or
* Remove or and shift operator from test
* Tests
* Add Github issue reference to release notes
* Update release notes
Co-Authored-By: Luciano Bello <luciano.bello@ibm.com>
* Added descriptive QiskitError message
* Add GitHub Issue link to release notes
* Remove release note
Release note is not required because Scheduler has not been included in any previous releases
* Update tests
* assertEqual instructions
* Adding inverse function to the ControlledGate class that calls the inverse of the base gate instead of relying on the one defined in Instruction. Includes test function.
* linting
* Fixed inverse when gate is directly of Type 'Gate', e.g. from a circuit to gate call.
* remove reference to ubase
ubase was recently removed.
* Handle cregs in circuit_to_gate() converter
Prior to this commit the circuit_to_get converter function was not
handling cregs at all. This led to an output definition with
instruction tuples of length 2 (inst object, [qbits]) instead of length
3 (inst object, [qbits], [cbits]). This would then cause potential
issues for operations that were assuming the standardized data format
with length three. This includes the inverse() method of a gate. This
commit fixes this issue by adding creg handling to the output gate
definition generation. While the only instructions with cregs set don't
have to_gate() methods and the converter won't work with them this is
still necessary to maintain compatibility with all gate methods, it will
just mean that cregs will always end up with [] except in the case of
custom gate defintions. The logic was also reworked to be slightly easier
to read since having multiple layers of nested map() calls gets hard to
debug.
Fixes#3545
* Just hardcode output cregs to empty list
Since gate objects can't have cregs set instead of going through all the
effort of trying to map what will always be an empty list this commit
just pivots this to hardcode the output clbit list to be an empty list.
This simplifies the code, and a commented is added to explain why.
* Add a test
* Test for global scoping of numpy seed in random_unitary
* Test for global scoping of numpy seed in random_density_matrix
* Fix numpy seed effects in random_unitary
* Fix numpy seed effects in __ginibre_matrix
* Fix numpy seed effects in pauli operators
* Release notes, patch issue #2850
* Linting
* Update releasenotes/notes/fix-numpy.random.seed-after-effects-74630974e79b1b7f.yaml
Co-Authored-By: SooluThomas <soolu.elto@gmail.com>
* Update releasenotes/notes/fix-numpy.random.seed-after-effects-74630974e79b1b7f.yaml
Co-Authored-By: SooluThomas <soolu.elto@gmail.com>
* added release notes for controlled gate class (#2862).
Also remove some unused imports in test_controlled_gate.py.
* remove pylint disable
* remove one more unused import
* change q_if to control
in expectation of pr #3455
* update release notes
include imports in release notes.
* start to_matrix method for ControlledGate
* add test to check to_matrix of standard gates
* remove stale code
* remove to_matrix from ControlledGate
consider adding back later.
* linting
* add exceptions to catch
* linting
* remove unused import
* added check for empty filters in Schedule._construct_filter
* added tests for empty filters for Schedule.filter and Schedule.exclude
* fixed style issue in test_schedule for filter testing
* simplified if statements in Schedule._construct_filter
* replace q_if with control
* fix test
* instruction_to_gate -> circuit_to_gate
* lint
* fix tests
* lint
* remove control from instructionset as not implemented
* Run BarrierBeforeFinalMeasurements pass regardless of property_set['is_swap_mapped']
* Fix test_after_transpile expected circuit drawing to include barriers before measurements
* Make test_after_transpile expected output a class attribute to fit within the line-length lint and style check
* added ControlledGate class
updated standard gates to return controlled version if it is also in the standard set.
* added assertions to some tests.
minor commit
added "controlled_ops" parameter
gate rules of gate before applying controls.
pass controlled gate tests
changing to recursive control
broken point
* added dmitri based decomposition from aqua
passing mu1 and mu3
tests working...confusing num_ctrl_qubits
linting
fix indentation error
fix circular import for python 3.5 and 3.6.
more import fixes
put aqua q_if back in, linting
minor commit
minor commit
linting
another attempt to fix circular import across all pltforms.
disable cyclic-import pylint check
another attempt to remove cyclic import
This also eliminates defining q_if in standard extension gates.
forgot to add module add_control.py
fix style
method from qi
* copied multi controlled gates from aqua
todo: convert the gates to ControlledGates
linting
style
simplify some tests
minor fix
* simplify code. catch rotation gates to avoid decomposition.
* copied multi controlled gates from aqua
todo: convert the gates to ControlledGates
linting
style
simplify some tests
minor fix
Co-authored-by: Shaohan Hu <shaohan.hu@ibm.com>
Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: Albert Frisch <alfr@de.ibm.com>
* simplify code. catch rotation gates to avoid decomposition.
* add reference to base controlled gate
This adds "base_gate" as class attribute of ControlledGate which is a class reference.
* add some tests. fix imports
* remove pdb
* linting
* add `to_gate` method to Instruction.
* lint
* linting
* linting
* add test for instruction_to_gate
* add phase argument when computing control matrix
* linting
* inital commit
* more testing!
* wrong-import-order
* label
* added ControlledGate class
updated standard gates to return controlled version if it is also in the standard set.
* added assertions to some tests.
minor commit
added "controlled_ops" parameter
gate rules of gate before applying controls.
pass controlled gate tests
changing to recursive control
broken point
* added dmitri based decomposition from aqua
passing mu1 and mu3
tests working...confusing num_ctrl_qubits
linting
fix indentation error
fix circular import for python 3.5 and 3.6.
more import fixes
put aqua q_if back in, linting
minor commit
minor commit
linting
another attempt to fix circular import across all pltforms.
disable cyclic-import pylint check
another attempt to remove cyclic import
This also eliminates defining q_if in standard extension gates.
forgot to add module add_control.py
fix style
method from qi
* copied multi controlled gates from aqua
todo: convert the gates to ControlledGates
linting
style
simplify some tests
minor fix
* simplify code. catch rotation gates to avoid decomposition.
* copied multi controlled gates from aqua
todo: convert the gates to ControlledGates
linting
style
simplify some tests
minor fix
Co-authored-by: Shaohan Hu <shaohan.hu@ibm.com>
Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: Albert Frisch <alfr@de.ibm.com>
* simplify code. catch rotation gates to avoid decomposition.
* add reference to base controlled gate
This adds "base_gate" as class attribute of ControlledGate which is a class reference.
* add some tests. fix imports
* remove pdb
* linting
* add `to_gate` method to Instruction.
* lint
* linting
* linting
* add test for instruction_to_gate
* add phase argument when computing control matrix
* linting
* Deprate PulseChannelSpec, deprecate Qubit, remove system topology (which was a helper for pulsechannelspec) and migrate tests to use backend.configuration instead
* Continue testt migration from more recent code
Add release notes about PulseChannelSpec deprecation.
Update AcquireInstruction to no longer support Qubit input type (rarely used).
* Fixup bug in test schedule
* Rewrite dag drawer to not use nxpd
The nxpd library is quite stale and hasn't seen an update in 3 years.
The most recent release of networkx 2.4 is incompatible with nxpd now
because nxpd was using deprecated (and now removed) api calls from
networkx. Additionally, the functionality provided by nxpd already
exists in networkx so there is no reason to rely on an additional
library outside of networkx and pydot. This commit updates the dag
drawer to no longer use nxpd and uses networkx's drawing features
instead.
* Cap networkx for python 3.5
In the networkx release notes for 2.4 [1] it states clearly that the 2.4
release is the last release with python 3.5 support. Since the release
timeline is not fixed and we may end up support python 3.5 in terra
longer than networkx this adds a capped version of networkx on 2.4 for
python 3.5.
[1] https://networkx.github.io/documentation/stable/release/release_2.4.html
* Adjust python 3.5 cap
Since networkx 2.4 is seemingly relying on the guaranteed insertion
ordering for dicts introduced in 3.6 for how we're using topological
sort this adjusts the cap previously introduced to be <2.4 instead of
<=2.4. This should avoid the failures related to this on python 3.5 and
networx 2.4.
* Avoid duplicate requirements with cap
* fix zeroed_width for gaussian and gaussian_square
* fix some definitions
* fix test
* make sampler midpoint by default
* fix rescale_amp docstrings, fix tests to reflect midpoint, fix sech