Skip to content

Commit

Permalink
Merge branch 'main' into move-target
Browse files Browse the repository at this point in the history
  • Loading branch information
raynelfss authored May 10, 2024
2 parents 2ba35a2 + b80885d commit 71873ab
Show file tree
Hide file tree
Showing 61 changed files with 1,000 additions and 695 deletions.
File renamed without changes.
13 changes: 6 additions & 7 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion crates/accelerate/src/sparse_pauli_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ impl ZXPaulis {
phases: &Bound<PyArray1<u8>>,
coeffs: &Bound<PyArray1<Complex64>>,
) -> PyResult<Self> {
let &[num_ops, num_qubits] = x.shape() else { unreachable!("PyArray2 must be 2D") };
let &[num_ops, num_qubits] = x.shape() else {
unreachable!("PyArray2 must be 2D")
};
if z.shape() != [num_ops, num_qubits] {
return Err(PyValueError::new_err(format!(
"'x' and 'z' have different shapes: {:?} and {:?}",
Expand Down
2 changes: 1 addition & 1 deletion crates/circuit/src/circuit_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl CircuitData {
0,
)?;
res.intern_context = self.intern_context.clone();
res.data = self.data.clone();
res.data.clone_from(&self.data);
Ok(res)
}

Expand Down
10 changes: 0 additions & 10 deletions crates/qasm3/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use pyo3::types::{PyList, PyString, PyTuple, PyType};
use crate::error::QASM3ImporterError;

pub trait PyRegister {
fn bit(&self, py: Python, index: usize) -> PyResult<Py<PyAny>>;
// This really should be
// fn iter<'a>(&'a self, py: Python<'a>) -> impl Iterator<Item = &'a PyAny>;
// or at a minimum
Expand All @@ -39,15 +38,6 @@ macro_rules! register_type {
}

impl PyRegister for $name {
/// Get an individual bit from the register.
fn bit(&self, py: Python, index: usize) -> PyResult<Py<PyAny>> {
// Unfortunately, `PyList::get_item_unchecked` isn't usable with the stable ABI.
self.items
.bind(py)
.get_item(index)
.map(|item| item.into_py(py))
}

fn bit_list<'a>(&'a self, py: Python<'a>) -> &Bound<'a, PyList> {
self.items.bind(py)
}
Expand Down
85 changes: 66 additions & 19 deletions docs/apidoc/index.rst
Original file line number Diff line number Diff line change
@@ -1,42 +1,89 @@
.. module:: qiskit
..
Within each section, the modules should be ordered alphabetically by
module name (not RST filename).
=============
API Reference
=============

Circuit construction:

.. toctree::
:maxdepth: 1

circuit
circuit_library
circuit_classical
circuit_singleton
compiler
visualization
classicalfunction
circuit_library
circuit_singleton

Quantum information:

.. toctree::
:maxdepth: 1

quantum_info

Transpilation:

.. toctree::
:maxdepth: 1

converters
assembler
dagcircuit
passmanager
synthesis
qiskit.synthesis.unitary.aqc
transpiler
transpiler_passes
transpiler_synthesis_plugins
transpiler_preset
transpiler_plugins

Primitives and providers:

.. toctree::
:maxdepth: 1

primitives
providers
providers_basic_provider
providers_fake_provider
providers_models
pulse
scheduler
synthesis
qiskit.synthesis.unitary.aqc
primitives

Results and visualizations:

.. toctree::
:maxdepth: 1

result
visualization

Serialization:

.. toctree::
:maxdepth: 1

qasm2
qasm3
qobj
qpy
quantum_info
result
transpiler
transpiler_passes
transpiler_preset
transpiler_plugins
transpiler_synthesis_plugins
utils

Pulse-level programming:

.. toctree::
:maxdepth: 1

pulse
scheduler

Other:

.. toctree::
:maxdepth: 1

assembler
compiler
exceptions
qobj
utils
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,13 @@ disable = [
# with the rationale
"arguments-renamed",
"broad-exception-raised",
"consider-iterating-dictionary",
"consider-using-dict-items",
"consider-using-enumerate",
"consider-using-f-string",
"no-member",
"no-value-for-parameter",
"not-context-manager",
"unexpected-keyword-arg",
"unnecessary-dict-index-lookup",
"unnecessary-dunder-call",
"unnecessary-lambda-assignment",
"unspecified-encoding",
Expand Down
15 changes: 5 additions & 10 deletions qiskit/assembler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@
.. currentmodule:: qiskit.assembler
Circuit Assembler
=================
Functions
=========
.. autofunction:: assemble_circuits
Schedule Assembler
==================
.. autofunction:: assemble_circuits
.. autofunction:: assemble_schedules
Disassembler
============
.. autofunction:: disassemble
RunConfig
=========
Classes
=======
.. autosummary::
:toctree: ../stubs/
Expand Down
4 changes: 2 additions & 2 deletions qiskit/circuit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@
.. _circuit-module-api:
API overview of :mod:`qiskit.circuit`
=====================================
API overview of qiskit.circuit
==============================
All objects here are described in more detail, and in their greater context in the following
sections. This section provides an overview of the API elements documented here.
Expand Down
9 changes: 5 additions & 4 deletions qiskit/circuit/classical/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@
Working with types
==================
There are some functions on these types exposed here as well. These are mostly expected to be used
only in manipulations of the expression tree; users who are building expressions using the
There are some additional functions on these types documented in the subsequent sections.
These are mostly expected to be used only in manipulations of the expression tree;
users who are building expressions using the
:ref:`user-facing construction interface <circuit-classical-expressions-expr-construction>` should
not need to use these.
Partial ordering of types
-------------------------
=========================
The type system is equipped with a partial ordering, where :math:`a < b` is interpreted as
":math:`a` is a strict subtype of :math:`b`". Note that the partial ordering is a subset of the
Expand All @@ -78,7 +79,7 @@
Casting between types
---------------------
=====================
It is common to need to cast values of one type to another type. The casting rules for this are
embedded into the :mod:`types` module. You can query the casting kinds using :func:`cast_kind`:
Expand Down
1 change: 1 addition & 0 deletions qiskit/circuit/classicalfunction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def grover_oracle(a: Int1, b: Int1, c: Int1, d: Int1) -> Int1:
Decorator for a classical function that returns a `ClassicalFunction` object.
.. autofunction:: classical_function
ClassicalFunction
-----------------
Expand Down
22 changes: 3 additions & 19 deletions qiskit/circuit/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,35 +129,19 @@
Standard Directives
===================
..
This summary table deliberately does not generate toctree entries; these directives are "owned"
by ``qiskit.circuit``.
Directives are operations to the quantum stack that are meant to be interpreted by the backend or
the transpiler. In general, the transpiler or backend might optionally ignore them if there is no
implementation for them.
..
This summary table deliberately does not generate toctree entries; these directives are "owned"
by ``qiskit.circuit``.
.. autosummary::
Barrier
* :class:`qiskit.circuit.Barrier`
Standard Operations
===================
Operations are non-reversible changes in the quantum state of the circuit.
..
This summary table deliberately does not generate toctree entries; these directives are "owned"
by ``qiskit.circuit``.
.. autosummary::
Measure
Reset
* :class:`qiskit.circuit.Measure`
* :class:`qiskit.circuit.Reset`
Generalized Gates
=================
Expand Down
8 changes: 8 additions & 0 deletions qiskit/circuit/library/data_preparation/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ class Initialize(Instruction):
the :class:`~.library.StatePreparation` class.
Note that ``Initialize`` is an :class:`~.circuit.Instruction` and not a :class:`.Gate` since it
contains a reset instruction, which is not unitary.
The initial state is prepared based on the :class:`~.library.Isometry` synthesis described in [1].
References:
1. Iten et al., Quantum circuits for isometries (2016).
`Phys. Rev. A 93, 032318
<https://journals.aps.org/pra/abstract/10.1103/PhysRevA.93.032318>`__.
"""

def __init__(
Expand Down
Loading

0 comments on commit 71873ab

Please sign in to comment.