Skip to content

Commit

Permalink
Prepare 0.15.0 release (#4850)
Browse files Browse the repository at this point in the history
* Prepare 0.15.0 release

This commit moves the release notes into a 0.15 subdirectory to keep
them separate from development notes post-release. It also adds an
incomplete 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 to tag the 0.15.0 release.

* Cleanup and fix dag deprelease notes and remove unused dag_drawer arg

This starts the processes of cleaning up and fixing the release notes by
starting with the release notes for DAGDependency and the supporting
functions. As part of that a release note for a new argument to the
dag_drawer was removed because that argument was not actually needed.
Since it was just being used to type check and it was just error prone.
This refactors the dag drawer so that the uneccessary arg is removed
and isinstance is just used.

* Avoid potential cyclic import in dag_drawer

* Start cleanup and fixing release notes

This commit starts the process of going through and cleaning up, fixing,
and rewriting the release notes for the release.

* Move and cleanup new release notes

* More release note cleanups and fixes

* More updates

* More feature releasenote updates

* Update another release note

* Start fixes of upgrade notes

* More upgrade note fixes

* More updates

* Apply suggestions from code review

Co-authored-by: Julien Gacon <[email protected]>

* Update phase estimate release note with review comments

* Move and fix new release notes

* Fix the rest of the deprecation notes

* More updates

* Update releasenotes/notes/0.15/u-and-phase-gate-e308fb4bb009014f.yaml

Co-authored-by: Julien Gacon <[email protected]>

* Finish first pass of release note fixes

* Update new release notes

* Remove out of date docstring addition

* Update 0.15.0-release-c7d85921f85f0b4d.yaml

* Move and touch up new release notes

* Move and fix new release notes

* Move new release note

* Fix whitespace in prelude

* Update releasenotes/notes/0.15/transpiler_fails_with_condition-9b4b4d66406548f0.yaml

Co-authored-by: Luciano Bello <[email protected]>

* Update rename-rescheduler-d4210a234714ed5d.yaml

* Apply suggestions from code review

* Update remove-marshmallow-validation-283fa62b3acc51e4.yaml

* Update remove-deprecated-qi-b7d5a8ca00849b02.yaml

* Apply suggestions from code review

Co-authored-by: Luciano Bello <[email protected]>

* Apply suggestions from code review

Co-authored-by: Luciano Bello <[email protected]>

Co-authored-by: Julien Gacon <[email protected]>
Co-authored-by: Ali Javadi-Abhari <[email protected]>
Co-authored-by: Luciano Bello <[email protected]>
  • Loading branch information
4 people authored Aug 6, 2020
1 parent a67440a commit 5e116b8
Show file tree
Hide file tree
Showing 131 changed files with 1,062 additions and 671 deletions.
2 changes: 2 additions & 0 deletions qiskit/circuit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
Qubit
ClassicalRegister
Clbit
AncillaRegister
AncillaQubit
Gates and Instructions
----------------------
Expand Down
4 changes: 4 additions & 0 deletions qiskit/circuit/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
HGate
IGate
MCPhaseGate
MCXGate
MCXGrayCode
MCXRecursive
MCXVChain
Measure
MSGate
PhaseGate
Expand Down
2 changes: 1 addition & 1 deletion qiskit/dagcircuit/dagdependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def draw(self, scale=0.7, filename=None, style='color'):
"""
from qiskit.visualization.dag_visualization import dag_drawer
return dag_drawer(dag=self, scale=scale, filename=filename,
style=style, category='dependency')
style=style)


def merge_no_duplicates(*iterables):
Expand Down
43 changes: 22 additions & 21 deletions qiskit/visualization/dag_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
HAS_PIL = False


def dag_drawer(dag, scale=0.7, filename=None, style='color', category=None):
def dag_drawer(dag, scale=0.7, filename=None, style='color'):
"""Plot the directed acyclic graph (dag) to represent operation dependencies
in a quantum circuit.
Expand All @@ -52,7 +52,6 @@ def dag_drawer(dag, scale=0.7, filename=None, style='color', category=None):
filename (str): file path to save image to (format inferred from name)
style (str): 'plain': B&W graph
'color' (default): color input/output/op nodes
category (str): 'dependency' for drawing DAG dependency
Returns:
PIL.Image: if in Jupyter notebook and not saving to file,
Expand Down Expand Up @@ -87,7 +86,11 @@ def dag_drawer(dag, scale=0.7, filename=None, style='color', category=None):
except ImportError:
raise ImportError("dag_drawer requires pydot. "
"Run 'pip install pydot'.")
if category is None:
# NOTE: use type str checking to avoid potential cyclical import
# the two tradeoffs ere that it will not handle subclasses and it is
# slower (which doesn't matter for a visualization function)
type_str = str(type(dag))
if 'dagcircuit.DAGDependency' in type_str:
G = dag.to_networkx()
G.graph['dpi'] = 100 * scale

Expand All @@ -96,25 +99,28 @@ def dag_drawer(dag, scale=0.7, filename=None, style='color', category=None):
elif style == 'color':
for node in G.nodes:
n = G.nodes[node]
n['label'] = node.name
if node.type == 'op':
n['label'] = str(node.node_id) + ': ' + node.name
if node.name == 'measure':
n['color'] = 'blue'
n['style'] = 'filled'
n['fillcolor'] = 'lightblue'
if node.type == 'in':
if node.name == 'barrier':
n['color'] = 'black'
n['style'] = 'filled'
n['fillcolor'] = 'green'
if node.type == 'out':
if node.name == 'snapshot':
n['color'] = 'black'
n['style'] = 'filled'
n['fillcolor'] = 'red'
for e in G.edges(data=True):
e[2]['label'] = e[2]['name']
if node.condition:
n['label'] = str(node.node_id) + ': ' + node.name + ' (conditional)'
n['color'] = 'black'
n['style'] = 'filled'
n['fillcolor'] = 'lightgreen'
else:
raise VisualizationError("Unrecognized style for the dag_drawer.")

elif category == 'dependency':
else:
G = dag.to_networkx()
G.graph['dpi'] = 100 * scale

Expand All @@ -123,28 +129,23 @@ def dag_drawer(dag, scale=0.7, filename=None, style='color', category=None):
elif style == 'color':
for node in G.nodes:
n = G.nodes[node]
n['label'] = str(node.node_id) + ': ' + node.name
if node.name == 'measure':
n['label'] = node.name
if node.type == 'op':
n['color'] = 'blue'
n['style'] = 'filled'
n['fillcolor'] = 'lightblue'
if node.name == 'barrier':
if node.type == 'in':
n['color'] = 'black'
n['style'] = 'filled'
n['fillcolor'] = 'green'
if node.name == 'snapshot':
if node.type == 'out':
n['color'] = 'black'
n['style'] = 'filled'
n['fillcolor'] = 'red'
if node.condition:
n['label'] = str(node.node_id) + ': ' + node.name + ' (conditional)'
n['color'] = 'black'
n['style'] = 'filled'
n['fillcolor'] = 'lightgreen'
for e in G.edges(data=True):
e[2]['label'] = e[2]['name']
else:
raise VisualizationError("Unrecognized style for the dag_drawer.")
else:
raise VisualizationError("Unrecognized category of DAG")

dot = to_pydot(G)

Expand Down
14 changes: 14 additions & 0 deletions releasenotes/notes/0.15/0.15.0-release-c7d85921f85f0b4d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
prelude: |
The 0.15.0 release includes several new features and bug fixes. Some
highlights for this release are:
This release includes the introduction of arbitrary
basis translation to the transpiler. This includes support for directly
targeting a broader range of device basis sets, e.g. backends
implementing RZ, RY, RZ, CZ or iSwap gates.
The :class:`~qiskit.circuits.QuantumCircuit` class now tracks global
phase. This means controlling a circuit which has global phase now
correctly adds a relative phase, and gate matrix definitions are now
exact rather than equal up to a global phase.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
fixes:
- |
The :class:`qiskit.circuit.QuantumCircuit` method
:attr:`~qiskit.circuit.QuantumCircuit.num_nonlocal_gates` previously
included multi-qubit :class:`qiskit.circuit.Instruction` objects
(for example, :class:`~qiskit.circuit.library.Barrier`) in its count of
non-local gates. This has been corrected so that only non-local
:class:`~qiskit.circuit.Gate` objects are counted.
Fixes `#4500 <https://github.com/Qiskit/qiskit-terra/issues/4500>`__
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
upgrade:
- |
Implementations of the multi-controlled X Gate (
:class:`~qiskit.circuit.library.MCXGrayCode`,
:class:`~qiskit.circuit.library.MCXRecursive`, and
:class:`~qiskit.circuit.library.MCXVChain`) have had their ``name``
properties changed to more accurately describe their
implementation: ``mcx_gray``, ``mcx_recursive``, and
``mcx_vchain`` respectively. Previously, these gates shared the
name ``mcx`` with :class:`~qiskit.circuit.library.MCXGate`, which caused
these gates to be incorrectly transpiled and simulated.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
fixes:
- |
:class:`~qiskit.circuit.ControlledGate` instances with a set
``ctrl_state`` were in some cases not being evaluated as equal, even if the
compared gates were equivalent. This has been resolved so that
Fixes `#4573 <https://github.com/Qiskit/qiskit-terra/issues/4573>`__
35 changes: 35 additions & 0 deletions releasenotes/notes/0.15/Add-canonical-form-47e0466ed57640f3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
features:
- |
A new DAG class :class:`qiskit.dagcircuit.DAGDependency` for representing
the dependency form of circuit, In this DAG, the nodes are
operations (gates, measure, barrier, etc...) and the edges corresponds to
non-commutation between two operations.
- |
Four new functions are added to :mod:`qiskit.converters` for converting back and
forth to :class:`~qiskit.dagcircuit.DAGDependency`. These functions are:
* :func:`~qiskit.converters.circuit_to_dagdependency` to convert
from a :class:`~qiskit.circuit.QuantumCircuit` object to a
:class:`~qiskit.dagcircuit.DAGDependency` object.
* :func:`~qiskit.converters.dagdependency_to_circuit` to convert from a
:class:`~qiskit.dagcircuit.DAGDependency` object to a
:class:`~qiskit.circuit.QuantumCircuit` object.
* :func:`~qiskit.converters.dag_to_dagdependency` to convert from
a :class:`~qiskit.dagcircuit.DAGCircuit` object to a
:class:`~qiskit.dagcircuit.DAGDependency` object.
* :func:`~qiskit.converters.dagdependency_to_ciruit` to convert from
a :class:`~qiskit.dagcircuit.DAGDependency` object to a
:class:`~qiskit.dagcircuit.DAGCircuit` object.
For example::
from qiskit.converters.dagdependency_to_circuit import dagdependency_to_circuit
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
circuit_in = QuantumCircuit(2)
circuit_in.h(qr[0])
circuit_in.h(qr[1])
dag_dependency = circuit_to_dagdependency(circuit_in)
circuit_out = dagdepency_to_circuit(dag_dependency)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
features:
- |
Two new transpiler passes have been added to :mod:`qiskit.transpiler.passes`
The first, :class:`~qiskit.transpiler.passes.UnrollCustomDefinitions`,
unrolls all instructions in the
circuit according to their :attr:`~qiskit.circuit.Instruction.definition`
property, stopping when reaching either the specified ``basis_gates``
or a set of gates in the provided
:class:`~qiskit.circuit.EquivalenceLibrary`. The second,
:class:`~qiskit.transpiler.passes.BasisTranslator`, uses the set of
translations in the provided :class:`~qiskit.circuit.EquivalenceLibrary` to
re-write circuit instructions in a specified basis.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
features:
- |
A new ``translation_method`` keyword argument has been added to
:func:`~qiskit.compiler.transpile` to allow selection of the method to be
used for translating circuits to the available device gates. For example,
``transpile(circ, backend, translation_method='translator')``. Valid
choices are:
* ``'unroller'``: to use the :class:`~qiskit.transpiler.passes.Unroller`
pass
* ``'translator'``: to use the
:class:`~qiskit.transpiler.passes.BasisTranslator` pass.
* ``'synthesis'``: to use the
:class:`~qiskit.transpiler.passes.UnitarySynthesis` pass.
The default value is ``'translator'``.
upgrade:
- |
By default the preset passmanagers in
:mod:`qiskit.transpiler.preset_passmanagers` are using
:class:`~qiskit.transpiler.passes.UnrollCustomDefinitions` and
:class:`~qiskit.transpiler.passes.BasisTranslator` to handle basis changing
instead of the previous default :class:`~qiskit.transpiler.passes.Unroller`.
This was done because the new passes are more flexible and allow targeting
any basis set, however the output may differ. To use the previous default
you can set the ``translation_method`` kwarg on
:func:`~qiskit.compiler.transpile` to ``'unroller'``.
17 changes: 17 additions & 0 deletions releasenotes/notes/0.15/add-counts-class-7c75bd94d12a161a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
features:
- |
A new class for handling counts result data, :class:`qiskit.result.Counts`,
has been added. This class is a subclass of ``dict`` and can be interacted
with like any other dictionary. But, it includes helper methods and
attributes for dealing with counts results from experiments and also
handles post processing and formatting of binary strings at object
initialization. A :class:`~qiskit.result.Counts` object can be created by
passing a dictionary of counts with the keys being either integers,
hexadecimal strings of the form ``'0x4a'``, binary strings of the form
``'0b1101'``, a bit string formatted across register and memory slots
(ie ``'00 10'``), or a dit string. For example::
from qiskit.result import Counts
counts = Counts({"0x0': 1, '0x1', 3, '0x2': 1020})
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
features:
- |
A new kwarg for ``init_qubits`` has been added to
:func:`~qiskit.compiler.assemble` and :func:`~qiskit.execute.execute`.
For backends that support this feature ``init_qubits`` can be used to
control whether the backend executing the circuits inserts any
initialization sequences at the start of each shot. By default this is set
to ``True`` meaning that all qubits can assumed to be in the ground state
at the start of each shot. However, when ``init_qubits`` is set to
``False`` qubits will be uninitialized at the start of each
experiment and between shots. Note, that the backend running the circuits
has to support this feature for this flag to have any effect.
31 changes: 31 additions & 0 deletions releasenotes/notes/0.15/add-rep-delay-c97d5aa8fc9696da.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
features:
- |
A new kwarg ``rep_delay`` has been added to
:func:`qiskit.compiler.assemble`, :func:`qiskit.execute.execute`, and the
constructor for :class:`~qiskit.qobj.PulseQobjtConfig`.qiskit
This new kwarg is used to denotes the time between program executions. It
must be chosen from the list of valid values set as the
``rep_delays`` from a backend's
:class:`~qiskit.providers.models.PulseBackendConfiguration` object which
can be accessed as ``backend.configuration().rep_delays``).
The ``rep_delay`` kwarg will only work on backends which allow for dynamic
repetition time. This will also be indicated in the
:class:`~qiskit.providers.models.PulseBackendConfiguration` object for a
backend as the ``dynamic_reprate_enabled`` attribute. If
``dynamic_reprate_enabled`` is ``False`` then the ``rep_time`` value
specified for :func:`qiskit.compiler.assemble`,
:func:`qiskit.execute.execute`, or the constructor for
:class:`~qiskit.qobj.PulseQobjtConfig` will be used rather than
``rep_delay``. ``rep_time`` only allows users to specify the duration of a
program, rather than the delay between programs.
- |
The ``qobj_schema.json`` JSON Schema file in :mod:`qiskit.schemas` has
been updated to include the ``rep_delay`` as an optional configuration
property for pulse qobjs.
- |
The ``backend_configuration_schema.json`` JSON Schema file in
mod:`qiskit.schemas` has been updated to include ``rep_delay_range`` and
``default_rep_delay`` as optional properties for a pulse backend
configuration.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
features:
- |
A new attribute, :attr:`~qiskit.circuit.QuantumCircuit.global_phase`,
which is is used for tracking the global phase has been added to the
:class:`qiskit.circuit.QuantumCircuit` class. For example::
import math
from qiskit import QuantumCircuit
circ = QuantumCircuit(1, global_phase=math.pi)
circ.u1(0)
The global phase may also be changed or queried with
``circ.global_phase`` in the above example. In either case the setting is
in radians. If the circuit is converted to an instruction or gate the
global phase is represented by two single qubit rotations on the first
qubit.
This allows for other methods and functions which consume a
:class:`~qiskit.circuit.QuantumCircuit` object to take global phase into
account. For example. with the
:attr:`~qiskit.circuit.QuantumCircuit.global_phase`
attribute the :meth:`~qiskit.circuit.Gate.to_matrix` method for a gate
can now exactly correspond to its decompositions instead of
just up to a global phase.
The same attribute has also been added to the
:class:`~qiskit.dagcircuit.DAGCircuit` class so that global phase
can be tracked when converting between
:class:`~qiskit.circuit.QuantumCircuit` and
:class:`~qiskit.dagcircuit.DAGCircuit`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
fixes:
- |
When accessing a bit from a
:class:`qiskit.circuit.QuantumRegister` or
:class:`qiskit.circuit.ClassicalRegister` by index when using numpy
`integer types` <https://numpy.org/doc/stable/user/basics.types.html>`__
would previously raise a ``CircuitError`` exception. This has been
resolved so numpy types can be used in addition to Python's built-in
``int`` type.
Fixes `#3929 <https://github.com/Qiskit/qiskit-terra/issues/3929>`__.
9 changes: 9 additions & 0 deletions releasenotes/notes/0.15/ancilla-qubit-cdf5fb28373b8553.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
features:
- |
Two new classes, :class:`~qiskit.circuit.AncillaRegister` and
:class:`~qiskit.circuit.AncillaQubit` have been added to the
:mod:`qiskit.circuit` module. These are subclasses of
:class:`~qiskit.circuit.QuantumRegister` and :class:`~qiskit.circuit.Qubit`
respectively and enable marking qubits being ancillas. This will allow
these qubits to be re-used in larger circuits and algorithms.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
fixes:
- |
The SI unit use for constructing :py:class:`qiskit.pulse.SetFrequency`
objects is in Hz, but when a :class:`~qiskit.qobj.PulseQobjInstruction`
object is created from a :py:class:`~qiskit.pulse.SetFrequency` instance
it needs to be converted to GHz. This conversion was missing from previous
releases and has been fixed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
deprecations:
- |
The ``qiskit.pulse.pulse_lib`` module has been deprecated and will be
removed in a future release. It has been renamed to
:py:mod:`qiskit.pulse.library` which should be used instead.
Loading

0 comments on commit 5e116b8

Please sign in to comment.