Commit Graph

66 Commits

Author SHA1 Message Date
Ali Javadi-Abhari 6086dbf1a9 Coupling map constructors (#3618)
* simple coupling map constructors

* release note

* add tests

* compare set of edges instead of list
2019-12-18 22:21:47 +00:00
Luciano Bello 9c140b4894 Setting limits for CSPLayout (#3515)
* 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
2019-12-16 17:01:55 -05:00
Ali Javadi-Abhari 06e56a900e add zxz decomposition (#3519) 2019-12-13 09:25:47 -05:00
Matthew Treinish f17f8f073e Add python 3.8 support and deprecate python 3.5 (#3268)
* 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>
2019-12-10 22:43:58 +02:00
Matthew Treinish 55ffda08ad Prepare for 0.11.0 release (#3549)
* Prepare for 0.11.0 release

This commit moves the release notes into a 0.11.0 subdirectory to keep
them separate from development notes post-release. It also adds a
release note to add the prelude section providing the high level
overview of the release. When this merges it should be the commit used
to tag the 0.11.0 release.

* Add more details to prelude about pulse schedule

This commit adds some additional explanation about the pulse scheduler
to the prelude section for 0.11.0.

Co-authored-by: Thomas Alexander <talexander@ibm.com>

* Move new release notes

* Drop python 3.8 and 3.5 from prelude

* Improve existing release notes

This commit goes through all the existing release note files and cleans
up both the content, formatting, and rst/sphinx syntax.

* Move more new release notes

* Add releasenote for no framechange schedule draw

* Move new release notes

* Adjust formatting and content of new releasenotes

* Move last releasenote

* Update releasenotes/notes/0.11/0.11.0-release-95f15c71d993bfcd.yaml

Co-Authored-By: Kevin Krsulich <kevin@krsulich.net>

* Update 0.11.0-release-95f15c71d993bfcd.yaml
2019-12-10 02:42:21 +00:00
Lauren Capelluto 1f9fb32bfe Deprecate cmd def (#3573)
* 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
2019-12-09 21:05:40 -05:00
Lauren Capelluto 007d47852f Format pulse defaults (#3526)
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.
2019-12-09 20:02:22 -05:00
Kevin Krsulich fd0ebfce51 Add release notes for #3307. (#3584) 2019-12-09 23:46:44 +00:00
Paul Nation fd33db9e48 Use backend n_qubits to check if circuit can fit on device if coupling_map is None (#3557)
* fix 1Q transpilation

* fix for backend=None

* Delete TESTING.ipynb

* testing 1Q

* A more generic condition

* release notes

* lint

* https://github.com/Qiskit/qiskit-terra/pull/3557/#discussion_r354864664

* https://github.com/Qiskit/qiskit-terra/pull/3557/#discussion_r354864791

* https://github.com/Qiskit/qiskit-terra/pull/3557/#discussion_r354867778
2019-12-06 20:54:35 +00:00
Jack J. Woehr 519b2e86ed Add validation of backend memory support when executing with memory=True (#3528)
* address 3251 by checking backend memory property when memory kwarg passed to execute()

* better python

* fixed circular import

* moved memory check to assemble.py per review by kdk

* change requested in review: fetch backend_name from config
2019-12-06 14:23:23 -05:00
SooluThomas 8d5ad21517 Use Enum for meas_level and meas_return (#3493)
* Added MeasLevel and MeasReturn classes

* Fix meas_level in compiler/assemble.py

* Fix meas_return in compiler/assemble.py

* Fix meas_level and meas_return of qiskit/exevute.py

* Fixed meas_return of qiskit/result/models.py

* Fixed typo of qiskit/result/models.py

* Change Enum to IntEnum

* Fix qiskit/result/models.py

* Fixed meas_level validation in qiskit/qobj/models/pulse.py

* Fixed meas_level in qiskit/result/result.py

* Fix lint

* Add reno release notes

* Fixed meas_level in qobj/converters/pulse_instruction.py

* Change MeasLevel class to qiskit/qobj/utils.py

* update MeasLevel import path

* added imports

* typo

* fix import typo

* updates - review suggestions

* Update release notes

* Update release notes

* Update MeasReturn
2019-12-06 01:36:31 +00:00
Cameron McGarry f273f6eb93 Fix side effects of setting numpy.random.seed (#3541)
* 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>
2019-12-05 21:30:52 +00:00
Thomas Alexander 788f59a8a6 Scheduler release note (#3551)
* Add scheduler release reno.

* Grammar fixes.

* Remove prelude from scheduler reno.
2019-12-05 18:17:37 +00:00
Luciano Bello 1698d37047 remove CXBase (#3543) 2019-12-05 15:54:43 +00:00
Luciano Bello be97cc1ab5 Remove implicit string cast of the snapshot label (#3544)
* Remove implicit string cast of the snapshot label

* unused import
2019-12-05 15:09:08 +00:00
Luciano Bello 0324a6fca5 Remove deprecated UBase gate (#3539)
* remove ubase

* release notes

* import not needed
2019-12-03 20:05:33 +00:00
Luciano Bello 1e0d3ae18a Round of deprecation removal (#3190)
* BaseModel.as_dict

* _parse_basis_gates

* Layout support for tuples

* bit.__getitem__

* layout from_tuplelist

* eq for bit

* tuple as gate arguments

* import warnings

* test/python/test_dagcircuit.py

* test.python.test_dagcircuit.TestDagRegisters.test_dag_get_qubits

* rest of test.python.test_dagcircuit

* fixing test.python.circuit.test_circuit_registers

* test.python.circuit.test_circuit_data.TestQuantumCircuitInstructionData.test_setting_data_is_validated

* test.python.circuit.test_circuit_data

* lint

* release note

* release notes
2019-12-03 18:03:43 +00:00
ewinston c4809d438c added release notes for controlled gate class (#2862). (#3465)
* 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.
2019-11-30 13:38:57 +00:00
Kevin Krsulich e7be587242 Revert addition of p as alias for s gate on QuantumCircuit. (#3505) 2019-11-28 11:24:54 +00:00
Ali Javadi-Abhari c3cdd355d3
Result marginal counts (#3446)
* add Result.get_marginal_counts

* add Result.get_marginal_counts

* releasenote

* move to result utility funcs

* add file

* lint

* lint

* ability to marginalize a Result object

* style

* avoid cyclic import
2019-11-21 13:17:01 -05:00
Luciano a859f85e56 Removing U0Gate (#3431)
* remove u0

* release note

* test_unroller.py

* test_text_drawer

* refs

* test/randomized/test_transpiler_equivalence.py

* 0.8 -> 0.9
2019-11-20 08:07:55 +00:00
Jack J. Woehr debbd39f41 Deal with None as return from job.queue_position() (#3458)
* Fix for #3422 ... deal with None as return from job.queue_postition()

* release note for queue_position issue

* Update releasenotes/notes/job_queue_position_None-da3e6c2a203bc795.yaml

accept amendment by reviewer.

Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>

* handle queue status of None for jupyter
2019-11-14 19:01:50 -05:00
Luciano f023fa32c0 CSP layout selector (#3043)
* some utf8 art

* CSP layout

* add dependency and test

* bug in undirected cm

* release notes and changelog

* rest

* docstring

* optional req

* lint

* disable

* import

* lint
2019-11-12 20:40:30 +00:00
Lauren Capelluto 4c5354c04a Deprecate backend config replacement (#3367)
* 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
2019-11-11 21:07:39 +00:00
Luciano edf2c497d5 Add layout score analysis pass (#3321)
* initial commit

* docstring

* docstring

* Update qiskit/transpiler/passes/mapping/layout_score.py

Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>

* += -> =

* docstring

* remove initial_layout param

* rename qiskit/transpiler/passes/mapping/layout_score.py qiskit/transpiler/passes/mapping/layout_2q_distance.py

* LayoutScore -> Layout2qDistance

* counter

* dyn property name

* docstring

* release note

* each two qubit gate in the circuit
2019-11-01 21:02:14 +00:00
Jack J. Woehr 299277d35e Add Instruction.is_parameterized() (#3328)
* added Instruction.is_parameterized()

* Applied new method Instruction.is_parameterized() in obvious places.
Added test case for Instruction.is_parameterized().

* release note for Instruction.is_parameterized

* Cleaned up for linter.
Added typographical style to release note.

* Added bound parameter test to test_is_parameterized()

* Added detail to release note.

* Updated the cases in Collect2qBlocks and CommutationAnalysis

* changed test to bind parameter to instruction in approved fashion

* corrected test
2019-10-30 16:55:29 -04:00
Lauren Capelluto 2ad7a666b4 Add useful methods to PulseBackendConfiguration (#3309)
* Add useful methods to PulseBackendConfiguration. This will remove the need for the redundant PulseChannelsSpec class in pulse.

* Add release notes

* Style: Remove unused import

* Remove old test

* Fix issue in test: plot gate map only works with > 5 qubits

* Respond to feedback: Valid + realistic hamiltonian in mocked configuration, releasenotes augmented to alert users of dt/dtm change, hamiltonian methods on config return whole hamiltonian + tests updated to match, and dt/dtm are put it proper units during init rather than access

* Style
2019-10-30 17:34:25 +00:00
faisaldebouni 556c2df4ab Add support for slicing and concatenation of PassManagers (#3209)
* implemented functions to enable slicing and concatenation of PassManagers

* fixed errors, added release notes, added unittests

* resolving conflict

* adapter implementation to new PassManager

* fixes a bug caused by shallow copy

* test name capitalization
2019-10-30 12:01:56 +00:00
Luciano 0b52e06117 release note for PR #3290 (#3339)
* release note for 3290

* both?

* issue entry
2019-10-29 22:47:26 +00:00
Kevin Krsulich a4b03ae34e
Add missing release notes for #3281. (#3340) 2019-10-28 17:05:33 -04:00
Matthew Treinish fb87e7c2e2 Add dual of mpl mathtext syntax for latex drawer labels (#3224)
* Add dual of mpl mathtext syntax for latex drawer labels

This commit adds a new feature to the latex drawer that adds support for
a similar syntax to matplotlib's mathtext to labels on the latex drawer.
In matplotlib if you specify a string between two dollar signs (for
example $\gamma$) that string will be parsed with mpl's native TeX
expression parser and that will be used to layout and render the string
per the TeX syntax. This uses the same syntax as mathtext, and enables
users to write raw latex syntax as gate labels between a pair of dollar
signs. All characters outside of the dollar signs are treated as utf8
and get encoded by pylatexenc to create valid latex, however all text
inside the dollar signs get passed verbatim to the output latex. This
enables users to mix and match having their unicode encoded for them and
manually passing latex

Fixes #3171

* Fix lint

* Use jupyter-execute instead of describing diagram

* Revert "Use jupyter-execute instead of describing diagram"

This reverts commit ab7bc18c39. Running
the code example in jupyter-execute will require a latex distribution
with qcircuit to be installed. That adds a lot of run time to the doc
build and a non-obvious dependency. To avoid this, we'll just rely on
the code example and a description of the output.
2019-10-28 13:54:59 -04:00
Matthew Treinish 581bec96df
Add alias for cnot function to cx() (#3255)
* Add alias for cnot function to cx()

We often call the cx gate a cnot. Especially when giving presentations
or intros to quantum information you have to explain that cx == cnot. To
make this a bit simpler this commit adds a alias to the
QuantumCircuit.cx() function QuantumCircuit.cnot(). This way when doing
code examples we can just say run "cnot".

* Add aliases for other common gate names

Just as with cx and cnot there are other common names used for several
other quantum gates that are often used interchangeably. These alias are
also added:

ccx -> toffoli
cswap -> fredkin
s -> p
sdg -> pdg
2019-10-25 16:40:33 -04:00
Christopher Zachow 1e3c165611 TranspilerAccessError is deprecated in favor of TranspilerError (#3222)
* deprecated TranspilerAccessError in favour of TranspilerError

* changed version for deprecation

* fixed linting errors

* fixed unused import

* added changelog and fixed deprecation
2019-10-24 11:09:07 -04:00
Matthew Treinish f8a7520fa6 Deprecate qx_color_scheme() (#3220)
* Deprecate qx_color_scheme()

In qiskit.visualization.circuit_drawer there is a qx_color_scheme
function which was used to generate a style dict for the mpl drawer that
has a color scheme which matches the old ibm quantum experience.
However, this color scheme is no longer used by the quantum experience
and this function is not used internally anywhere. This commit
deprecates this function. Post removal if anyone was using this they can
just hardcode the dict returned by the function in their code and use
that as the style dict for mpl visualizations.

* Update circuit_visualization.py
2019-10-24 09:39:18 -04:00
Matthew Treinish 4a6eb32337
Mostly remove sympy and deprecate sympy Instruction parameters (#3156)
* Remove sympy from everywhere

This commit removes all the sympy usage from qiskit-terra. Sympy is very
slow, not just to perform computations, but also to just import (being
the second slowest import in terra, only behind qiskit.version which
calls git and pip in a subprocess) and doesn't actually provide us any
real advantages inside terra. None of the expressions or calculations
terra is doing need to be done symbolically, and using sympy as just an
output formatter (to get pretty output for things like pi) is overkill.

* Fix lint

* Fixes from running openqasm conformance tests

* Import sympy lazily for circuit Parameters.

* Add back sympy to requirements

While sympy has been removed from most places in the repo as of this
point, it is still used internally in the Parameter and
ParameterExpansion classes. The imports there have been made runtime to
remove the import performance impact and they are self contained in
those classes as of this commit. We can remove sympy from the
requirements in the future when we come up with way to replace the
parameter classes' use of sympy we can remove it from the requirements
lists.

* Make type warning a deprecation warning

* Fix rebase issue (and unnecessary runtime import)

* Update instruction parameter type handling

This commit updates some issues found during code review with the
parameter handling. Now instead of casting string parameters as a float
incorrectly, this uses them to create a new symbolic parameter. Also for
numpy number types that are not caught by the earlier type checks item()
is called as was the previous behavior.

* Revert switch from Node.sym->Node.num()

For ast Node parameter types that were passed as parameters for an
instruction the method call to get the value was incorrectly changed
to num() from sym(), which doesn't exist. This was a sloppy regex find
replace that did it by accident. This commit reverts that mistake and
restores the functionality.

* Deprecate not remove sympy.basic and sympy.matrix params

This commit adds back support, albeit it deprecated form, for passing in
instruction parameters as sympy.basic and sympy.matrix objects. It also
updates the release notes to reflect this change.

* Add deprecation for sympy.Expr instruction param too

* Update release notes

* Remove sympy types usage from unit tests

This commit removes the usage of sympy types from unit tests. There were
several cases of unit tests that were using sympy's pi or similar
constants for no particular reason. Since this usage is now deprecated
it is better to remove this. The only sympy usage that remains in the
tests now are for test cases that are explicitly testing behavior with
sympy. These will remain until the sympy support has been removed since
we need to verify that the deprecated feature still works as is until
removal.

* Update release of deprecation to 0.11.0

* Update changed error exception class

* lint
2019-10-23 16:15:44 -04:00
Lauren Capelluto 9e32d58c88 Remove buffer options in Pulse (#3297)
* Deprecate buffer options in Pulse

* Fill in warning message, update tests

* Add reno note

* Remove unused MeasureChannel import
2019-10-23 15:54:16 -04:00
SooluThomas fcfdb8be1a Added new methods to BackendProperties (#3131)
* Added get method

* Added new usability methods

* Standardized code, added error messages and get_gate_property

* Added missing import statements

* Updated error messages

* Added Tests

* Added Tests

* Removed unwanted error messages

* Added _to_tuple

* Updated fake_openpulse_2q.py

* Removed the backend properties test

* Added tests for backend properties

* Added Fake openpulse

* Added _to_tuple

* added typehints to gate_error

* Added tests

* Removed _to_tuple

* fix lints

* fix lints

* Tests

* Updated gate_error and gate_length

* Standardized Docstrings

* Added gates and qubits for backward compatibility

* Changed get_gate_property to gate_property

* Changed get_qubit_property to qubit_property

* Fix lint of gate_property

* Change the parameter name of gate_property to operation

* Added warning for qubit=None and name=not none

* Added tests to check PulseError

* Lauren's bug fix

* Added another exception raise to gate_property

* Remove comments and fixed a lint error

* Changes from review

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Changes from review

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Removed defaultdict

* patches

* Removed unused imports

* Fixed few lints

* More Changes to docstrings and dict logic

* Updated docstrings

* Updated typehints and fixed lint

* Fix travis lint error

* revert the code from line 68-102

* Edit json file with incorrect entries

* Change return to returns in docstring

* Fix lints

* fix lints

* Fix lint

* Fix Lint

* fix Lints

* Revert "fix Lints"

This reverts commit d8c30d71e0.

* fix Lint

* Fix Lint

* fix lint

* Fix Lint

* Update qiskit/providers/models/backendproperties.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Update qiskit/providers/models/backendproperties.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Update qiskit/providers/models/backendproperties.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* added review changes

* Added release notes

* fixed requested review changes

* Added test for apply_prefix()

* Added newline to the end of file

* Changed operation to gates

* Fix typo and lint

* Added new method frequency(qubit)

* Added frequency to release notes

* Cleaning up

* Added new methods t2(qubit) and readout_error(qubit)

* Typo in docstring

* Fix lint and typos

* Update release note

* Update release note

* Update qiskit/test/mock/fake_openpulse_2q.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Update qiskit/test/mock/fake_openpulse_2q.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Typo in docstring

* Update qiskit/providers/models/backendproperties.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Remove _to_tuple()

* Replaced PulseError with BackendPropertyError
2019-10-21 12:46:45 -04:00
Matthew Treinish d9be39eed7
Prepare for the 0.10.0 release (#3262)
* Prepare for the 0.10.0 release

This commit moves the release notes into a 0.10.0 subdirectory to keep
them separate from development notes post-release. It also adds a
release note to add the prelude section providing the high level
overview of the release. When this merge it should be the commit used to
tag the 0.10.0 release.

* Actually set twine password for upload

* Move new release notes to 0.10 dir

* Tweak prelude wording
2019-10-16 10:38:36 -04:00
Christopher J. Wood 845bf805de Add support for partial results to Result class (#3217)
* allow accessing partial results

* add release doc
2019-10-15 12:09:43 -04:00
Kevin Krsulich 14dedb04aa Add release notes for ion trap merge. (#3254)
* Rename basis to basis_gates for consistency in MSBasisDecomposer.

* Remove target basis limitation for MSBasisDecomposer.

* Clarify MSBasisDecomposer unrolling requirement.

* Add release note for ion trap support (#3214).
2019-10-14 15:04:31 -04:00
Matthew Treinish 998c232b00 Update release note styling and wording (#3252)
This commit updates some styling and wording issues in the release notes
for the 0.10.0 release so far. The most common issues is the use of
markdown style formatting instead of rst which is what reno uses.
2019-10-14 17:00:37 +08:00
Matthew Treinish 6e7cde4649 Deprecate passing in an ast node as a instruction parameter (#3240)
This commit deprecates the option of passing in a circuit parameter of
a qasm.node.Node type. Passing in qasm ast nodes as a parameter is
rarely used and is not actually done anywhere in the qiskit-terra code
or tests. Additionally there is the qiskit ast_to_circuit converter
which will take a program node object (the root node of a qasm ast) and
convert that directly to a circuit object.
2019-10-11 10:04:24 -04:00
Matthew Treinish 352f940dfa Add ax kwarg to matplotlib visualization functions (#3053)
* Add ax kwarg to matplotlib visualization functions

This commit adds support for passing a matplotlib axes to visualization
functions. This enables integrating the qiskit visualizations into a
larger matplotlib visualization. When an ax kwarg is set that input will
be used for the output visualization and a new figure will not be
generated or returned.

Fixes #1950

* typo in release note

* Add ax kwarg to matplotlib visualization functions

This commit adds support for passing a matplotlib axes to visualization
functions. This enables integrating the qiskit visualizations into a
larger matplotlib visualization. When an ax kwarg is set that input will
be used for the output visualization and a new figure will not be
generated or returned.

Fixes #1950

* Fix lint and typos

* pylint: disable=invalid-name

* Fix lost lines from rebase

As part of rebasing and cleaning up the branch from several failed merge
attempts a few lines from plot_state_city() were lost. This commit fixes
that mistake and restores the z axis labels which were missing from the
imaginary component subplot.

* Fix rebase typo

* Revert "pylint: disable=invalid-name"

This reverts commit 5566611719.
2019-10-08 08:22:51 -04:00
Luciano a934b1f948
Add new passmanager.replace(index, ...) method (#3004)
* replace method

* error handle

* lint

* changelog

* lint

* release note

* key->index

* error message

* lint

* release note

* iamges

* replace images for text
2019-10-04 21:02:24 -04:00
Matt-Stypulkoski 7ac8f892b0 Add measure_all, measure_active, remove_final_measures methods (#2993)
* Add measure_all, measure_active, remove_final_measurement methods

* Add testing for measure_all, measure_active, remove_final_measurements

* Rename remove_final_measurements to remove_final_measures

* Rename test_remove_final_measurements to test_remove_final_measures

* Fix incorrect method call in test_remove_final_measures

* Fix remove_final_measures to only delete ClassicalRegister if it is unused. Fix measure_active to only check for non-idle qubits instead of  non-idle qubits and clbits

* Add test_remove_final_measures_multiple_measures

* Remove 'gates' from docstrings when referring to measurements

* Rename remove_final_measures to remove_final_measurements

* Rework remove_final_measurements to use RemoveFinalMeasurements pass

* Add RemoveFinalMeasurements pass

* Add remove_final_measurements module

* Rework test_remove_final_measurements_multiple_measures to work with new circuit.remove_final_measurements

* Add pylint disable-cyclic-import to remove_final_measurements

* tests

* fix test

* test to avoid name conflict

* avoid code repetition

* Add QuantumCircuit methods to add and remove final measurements

* Add newline at end of file

* Change inst.control to inst.condition
2019-10-04 14:33:57 -04:00
ewinston ef828be2c7 add instruction.control deprecation release notes (#3188) 2019-10-04 14:03:44 -04:00
Paul Nation bae322f0d6 DenseLayout is noise-aware
* initial_checkin

* make level 2 dense noise adaptive

* unused import

* make simpiler

* fix no cx or meas

* fix empty circ

* fix test

* remove text

* apply suggestions

* formating the test file

* release note
2019-10-03 14:30:20 -04:00
nkanazawa 5ee0d2496c Add memory_slots to pulse experimental header (#3048)
* add memory_slots to experimental header

* add schedule independent memory slots and common memory slots in qobj config

* remove schedule import

* fix tmp memory slot size

* add test for schedules with different memory slot sizes

* add reno
2019-10-01 11:05:08 -04:00
brandhsn 352f2bd1ff Modified rzz visualization in latex circuit drawer to match cu1 (#3155)
* Modified rzz visualization in latex circuit drawer to match the text/mpl drawer (#1957)

* added release note

* small release note fix
2019-09-29 21:38:16 -04:00
Jack J. Woehr 7a51637d27 Fix circuit drawing justification (#3061)
Fixes #2802

qiskit/visualization/utils.py _get_layered_instructions() was erroneous and did not justify left nor right correctly. I have reworked that code which underlies many visual representations of circuits to the user.

* refactored, needs more work on right justification

* Looks like this works for qiskit-terra issue #2802

* May fix first test failure for this pull request, while causing another?

* Draws conditionals on ClassicalRegister correctly now.

* - Occurs check for gate in gates leads to good test results.
- Added a few more self.maxDiff = None while debugging. Should they be pulled out?

* tabs and trailing spaces ;)

* removed the maxDiff's because they make the Style and lint test in Python 3.5 fail

* added tests
modified changelog

* Test case extended to include original issue reported in #2802

* oops, left a maxDiff=None in from testing. Fixed

* changes to utils.py requested by reviewer maddy-tod

* test cases split as requested by reviewer maddy-tod

* added circuit diagrams in comments to new tests

* removed note from changelog and made it a release note per @mtreinish

* made _LayerSpooler a private class

* Revert "Remove changelog and document automated creation (#3109)"

This reverts commit effad1228e.

* Make _LayerSpooler a subclass of list

The _LayerSpooler class was only ever used as list. While the class was
an independent type it basically just wrapped an internal list. THen
there were helper functions to access and manipulate that list. These
methods just duplicated what python already provides and the list class
itself already implements. This commit fixes this so the _LayerSpooler
itself is a subclass of list so when it's initialized you can just treat
it as the output list it was generating.

* Clean up release note, fix only, not prelude

* un reverted my revert of CONTRIBUTING.md

* refactored, needs more work on right justification

* Looks like this works for qiskit-terra issue #2802

* May fix first test failure for this pull request, while causing another?

* Draws conditionals on ClassicalRegister correctly now.

* - Occurs check for gate in gates leads to good test results.
- Added a few more self.maxDiff = None while debugging. Should they be pulled out?

* tabs and trailing spaces ;)

* removed the maxDiff's because they make the Style and lint test in Python 3.5 fail

* added tests
modified changelog

* Test case extended to include original issue reported in #2802

* oops, left a maxDiff=None in from testing. Fixed

* changes to utils.py requested by reviewer maddy-tod

* test cases split as requested by reviewer maddy-tod

* added circuit diagrams in comments to new tests

* removed note from changelog and made it a release note per @mtreinish

* made _LayerSpooler a private class

* Make _LayerSpooler a subclass of list

The _LayerSpooler class was only ever used as list. While the class was
an independent type it basically just wrapped an internal list. THen
there were helper functions to access and manipulate that list. These
methods just duplicated what python already provides and the list class
itself already implements. This commit fixes this so the _LayerSpooler
itself is a subclass of list so when it's initialized you can just treat
it as the output list it was generating.

* Clean up release note, fix only, not prelude

* put back missing section
2019-09-26 09:03:41 -04:00