Skip to content

Commit

Permalink
Merge branch 'main' into display_text_flow
Browse files Browse the repository at this point in the history
  • Loading branch information
enavarro51 authored Jul 28, 2023
2 parents 6f890fd + c8552f6 commit f342013
Show file tree
Hide file tree
Showing 188 changed files with 2,737 additions and 1,290 deletions.
2 changes: 1 addition & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pull_request_rules:
actions:
backport:
branches:
- stable/0.24
- stable/0.25
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = ["crates/*"]
# to inherit from this rather than needing to duplicate its content themselves. Until we get there,
# keep this in sync with each subpackage `Cargo.toml`'s `package` key.
[workspace.package]
version = "0.25.0"
version = "0.45.0"
edition = "2021"
rust-version = "1.61" # Keep in sync with README.md and rust-toolchain.toml.
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/accelerate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "qiskit_accelerate"
# The following options can be inherited with (e.g.) `version.workspace = true` once we hit Rust
# 1.64. Until then, keep in sync with the root `Cargo.toml`.
version = "0.25.0"
version = "0.45.0"
edition = "2021"
rust-version = "1.61"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/qasm2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "qiskit-qasm2"
# The following options can be inherited with (e.g.) `version.workspace = true` once we hit Rust
# 1.64. Until then, keep in sync with the root `Cargo.toml`.
version = "0.25.0"
version = "0.45.0"
edition = "2021"
rust-version = "1.61"
license = "Apache-2.0"
Expand Down
9 changes: 9 additions & 0 deletions crates/qasm2/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,15 @@ impl State {
}
self.check_trailing_comma(comma.as_ref())?;
qubits
} else if self.strict {
return Err(QASM2ParseError::new_err(message_generic(
Some(&Position::new(
self.current_filename(),
barrier_token.line,
barrier_token.col,
)),
"[strict] barrier statements must have at least one argument",
)));
} else if let Some(num_gate_qubits) = num_gate_qubits {
(0..num_gate_qubits).map(QubitId::new).collect::<Vec<_>>()
} else {
Expand Down
44 changes: 17 additions & 27 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{#
The general principle of this is that we manually document attributes here in
the same file, but give all methods their own page. By default, we document
We show all the class's methods and attributes on the same page. By default, we document
all methods, including those defined by parent classes.
-#}

Expand All @@ -9,33 +8,24 @@
.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
{#-
Avoid having autodoc populate the class with the members we're about to
summarize to avoid duplication.
#}
:no-members:
:show-inheritance:
{#
Methods all get their own separate page, with their names and the first lines
of their docstrings tabulated. The documentation from `__init__` is
automatically included in the standard class documentation, so we don't want
to repeat it.
-#}
{% block methods_summary %}{% set wanted_methods = (methods | reject('==', '__init__') | list) %}{% if wanted_methods %}
.. rubric:: Methods

.. autosummary::
:nosignatures:
:toctree: ../stubs/
{% for item in wanted_methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}{% endblock %}

{% block attributes_summary %}{% if attributes %}
{% block attributes_summary %}
{% if attributes %}
.. rubric:: Attributes
{# Attributes should all be summarized directly on the same page. -#}
{% for item in attributes %}
{% for item in attributes %}
.. autoattribute:: {{ item }}
{%- endfor %}
{% endif %}{% endblock -%}
{%- endfor %}
{% endif %}
{% endblock -%}

{% block methods_summary %}
{% set wanted_methods = (methods | reject('==', '__init__') | list) %}
{% if wanted_methods %}
.. rubric:: Methods
{% for item in wanted_methods %}
.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
44 changes: 17 additions & 27 deletions docs/_templates/autosummary/class_no_inherited_members.rst
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
{#
This is very similar to the default class template, except this one is used
when we don't want to generate any inherited methods.
-#}
{# This is identical to class.rst, except for the filtering in `set wanted_methods`. -#}

{{ objname | escape | underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
{#-
Avoid having autodoc populate the class with the members we're about to
summarize to avoid duplication.
#}
:no-members:
:show-inheritance:
{#
Methods all get their own separate page, with their names and the first lines
of their docstrings tabulated.
-#}
{% block methods_summary %}{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %}{% if wanted_methods %}
.. rubric:: Methods Defined Here

.. autosummary::
:nosignatures:
:toctree: ../stubs/
{% for item in wanted_methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}{% endblock %}

{% block attributes_summary %}{% if attributes %}
{% block attributes_summary %}
{% if attributes %}
.. rubric:: Attributes
{# Attributes should all be summarized directly on the same page. -#}
{% for item in attributes %}
{% for item in attributes %}
.. autoattribute:: {{ item }}
{%- endfor %}
{% endif %}{% endblock -%}
{%- endfor %}
{% endif %}
{% endblock -%}

{% block methods_summary %}
{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %}
{% if wanted_methods %}
.. rubric:: Methods
{% for item in wanted_methods %}
.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
6 changes: 6 additions & 0 deletions docs/apidocs/passmanager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _qiskit-passmanager:

.. automodule:: qiskit.passmanager
:no-members:
:no-inherited-members:
:no-special-members:
1 change: 1 addition & 0 deletions docs/apidocs/terra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Qiskit Terra API Reference
assembler
dagcircuit
extensions
passmanager
providers_basicaer
providers
providers_fake_provider
Expand Down
13 changes: 9 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
author = "Qiskit Development Team"

# The short X.Y version
version = "0.25"
version = "0.45"
# The full version, including alpha/beta/rc tags
release = "0.25.0"
release = "0.45.0"

extensions = [
"sphinx.ext.napoleon",
Expand Down Expand Up @@ -57,8 +57,13 @@

pygments_style = "colorful"

# Whether module names are included in crossrefs of functions, classes, etc.
add_module_names = False
# This adds the module name to e.g. function API docs. We use the default of True because our
# module pages sometimes have functions from submodules on the page, and we want to make clear
# that you must include the submodule to import it. We should strongly consider reorganizing our
# code to avoid this, i.e. re-exporting the submodule members from the top-level module. Once fixed
# and verified by only having a single `.. currentmodule::` in the file, we can turn this back to
# False.
add_module_names = True

# A list of prefixes that are ignored for sorting the Python module index
# (e.g., if this is set to ['foo.'], then foo.bar is shown under B, not F).
Expand Down
2 changes: 1 addition & 1 deletion qiskit/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.25.0
0.45.0
33 changes: 14 additions & 19 deletions qiskit/algorithms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
The :mod:`qiskit.algorithms` module has been migrated to an independent package:
https://github.com/qiskit-community/qiskit-algorithms.
The current import path is deprecated and will be removed no earlier
than 3 months after the release date. You can run ``pip install qiskit_algorithms``
and import ``from qiskit_algorithms`` instead.
than 3 months after the release date. If your code uses primitives, you can run
``pip install qiskit_algorithms`` and import ``from qiskit_algorithms`` instead.
If you use opflow/quantum instance-based algorithms, please update your code to
use primitives following: https://qisk.it/algo_migration before migrating to
the new package.
It contains a collection of quantum algorithms, for use with quantum computers, to
carry out research and investigate how to solve problems in different domains on
Expand Down Expand Up @@ -277,23 +280,7 @@
Exceptions
----------
.. autosummary::
:toctree: ../stubs/
AlgorithmError
Utility methods
---------------
Utility methods used by algorithms.
.. autosummary::
:toctree: ../stubs/
eval_observables
estimate_observables
.. autoexception:: AlgorithmError
Utility classes
---------------
Expand All @@ -305,6 +292,14 @@
AlgorithmJob
Utility functions
-----------------
Utility functions used by algorithms.
.. autofunction:: eval_observables
.. autofunction:: estimate_observables
"""
import warnings

Expand Down
5 changes: 3 additions & 2 deletions qiskit/algorithms/optimizers/nft.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ def nakanishi_fujii_todo(
`OptimizeResult` for a description of other attributes.
Notes:
In this optimization method, the optimization function have to satisfy
three conditions written in [1].
three conditions written in [2]_.
References:
.. [1] K. M. Nakanishi, K. Fujii, and S. Todo. 2019.
.. [2] K. M. Nakanishi, K. Fujii, and S. Todo. 2019.
Sequential minimal optimization for quantum-classical hybrid algorithms.
arXiv preprint arXiv:1903.12166.
"""
Expand Down
15 changes: 3 additions & 12 deletions qiskit/assembler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,17 @@
Circuit Assembler
=================
.. autosummary::
:toctree: ../stubs/
assemble_circuits
.. autofunction:: assemble_circuits
Schedule Assembler
==================
.. autosummary::
:toctree: ../stubs/
assemble_schedules
.. autofunction:: assemble_schedules
Disassembler
============
.. autosummary::
:toctree: ../stubs/
disassemble
.. autofunction:: disassemble
RunConfig
=========
Expand Down
45 changes: 38 additions & 7 deletions qiskit/circuit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,41 @@
The :class:`.SwitchCaseOp` also understands a special value:
.. py:data: CASE_DEFAULT
Used as a possible "label" in a :class:`.SwitchCaseOp` to represent the default case. This will
always match, if it is tried.
.. py:data:: CASE_DEFAULT
A special object that represents the "default" case of a switch statement. If you use this as a
case target, it must be the last case, and will match anything that wasn't already matched. For
example::
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit.circuit import SwitchCaseOp, CASE_DEFAULT
body0 = QuantumCircuit(2, 2)
body0.x(0)
body1 = QuantumCircuit(2, 2)
body1.z(0)
body2 = QuantumCircuit(2, 2)
body2.cx(0, 1)
qr, cr = QuantumRegister(2), ClassicalRegister(2)
qc = QuantumCircuit(qr, cr)
qc.switch(cr, [(0, body0), (1, body1), (CASE_DEFAULT, body2)], qr, cr)
When using the builder interface of :meth:`.QuantumCircuit.switch`, this can also be accessed as
the ``DEFAULT`` attribute of the bound case-builder object, such as::
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
qr, cr = QuantumRegister(2), ClassicalRegister(2)
qc = QuantumCircuit(qr, cr)
with qc.switch(cr) as case:
with case(0):
qc.x(0)
with case(1):
qc.z(0)
with case(case.DEFAULT):
qc.cx(0, 1)
Parametric Quantum Circuits
---------------------------
Expand All @@ -313,10 +345,9 @@
Random Circuits
---------------
.. autosummary::
:toctree: ../stubs/
random.random_circuit
.. currentmodule:: qiskit.circuit.random
.. autofunction:: random_circuit
.. currentmodule:: qiskit.circuit
"""
from .quantumcircuit import QuantumCircuit
from .classicalregister import ClassicalRegister, Clbit
Expand Down
Loading

0 comments on commit f342013

Please sign in to comment.