diff --git a/docs/api/qiskit/dev/assembler.mdx b/docs/api/qiskit/dev/assembler.mdx index cff940fae72..f6e6bb4861c 100644 --- a/docs/api/qiskit/dev/assembler.mdx +++ b/docs/api/qiskit/dev/assembler.mdx @@ -18,7 +18,7 @@ python_api_name: qiskit.assembler `qiskit.assembler` -## Circuit Assembler +## Functions ### assemble\_circuits @@ -61,8 +61,6 @@ python_api_name: qiskit.assembler ``` -## Schedule Assembler - ### assemble\_schedules @@ -125,8 +123,6 @@ python_api_name: qiskit.assembler ``` -## Disassembler - ### disassemble @@ -172,7 +168,7 @@ python_api_name: qiskit.assembler ``` -## RunConfig +## Classes | | | | -------------------------------------------------------------------------------------------------------------- | ---------------------------- | diff --git a/docs/api/qiskit/dev/circuit.mdx b/docs/api/qiskit/dev/circuit.mdx index 3249fd1fff7..aa970918b45 100644 --- a/docs/api/qiskit/dev/circuit.mdx +++ b/docs/api/qiskit/dev/circuit.mdx @@ -147,11 +147,7 @@ When mapping to hardware, virtual qubits must be assigned to *hardware qubits*. -## API overview of - - - -`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. diff --git a/docs/api/qiskit/dev/circuit_classical.mdx b/docs/api/qiskit/dev/circuit_classical.mdx index 9bf96123c43..68b1babab30 100644 --- a/docs/api/qiskit/dev/circuit_classical.mdx +++ b/docs/api/qiskit/dev/circuit_classical.mdx @@ -943,15 +943,15 @@ Note that [`Uint`](#qiskit.circuit.classical.types.Uint "qiskit.circuit.classica ### 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 [user-facing construction interface](#circuit-classical-expressions-expr-construction) should not need to use these. +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 [user-facing construction interface](#circuit-classical-expressions-expr-construction) should not need to use these. -#### Partial ordering of types +### Partial ordering of types The type system is equipped with a partial ordering, where $a < b$ is interpreted as “$a$ is a strict subtype of $b$”. Note that the partial ordering is a subset of the directed graph that describes the allowed explicit casting operations between types. The partial ordering defines when one type may be lossless directly interpreted as another. The low-level interface to querying the subtyping relationship is the [`order()`](#qiskit.circuit.classical.types.order "qiskit.circuit.classical.types.order") function. -##### order +#### order Get the ordering relationship between the two types as an enumeration value. @@ -980,7 +980,7 @@ The low-level interface to querying the subtyping relationship is the [`order()` The return value is an enumeration [`Ordering`](#qiskit.circuit.classical.types.Ordering "qiskit.circuit.classical.types.Ordering") that describes what, if any, subtyping relationship exists between the two types. -##### Ordering +#### Ordering Enumeration listing the possible relations between two types. Types only have a partial ordering, so it’s possible for two types to have no sub-typing relationship. @@ -990,7 +990,7 @@ The return value is an enumeration [`Ordering`](#qiskit.circuit.classical.types. Some helper methods are then defined in terms of this low-level [`order()`](#qiskit.circuit.classical.types.order "qiskit.circuit.classical.types.order") primitive: -##### is\_subtype +#### is\_subtype Does the relation $\text{left} \le \text{right}$ hold? If there is no ordering relation between the two types, then this returns `False`. If `strict`, then the equality is also forbidden. @@ -1019,7 +1019,7 @@ Some helper methods are then defined in terms of this low-level [`order()`](#qis [bool](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)") -##### is\_supertype +#### is\_supertype Does the relation $\text{left} \ge \text{right}$ hold? If there is no ordering relation between the two types, then this returns `False`. If `strict`, then the equality is also forbidden. @@ -1048,7 +1048,7 @@ Some helper methods are then defined in terms of this low-level [`order()`](#qis [bool](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)") -##### greater +#### greater Get the greater of the two types, assuming that there is an ordering relation between them. Technically, this is a slightly restricted version of the concept of the ‘meet’ of the two types in that the return value must be one of the inputs. In practice in the type system there is no concept of a ‘sum’ type, so the ‘meet’ exists if and only if there is an ordering between the two types, and is equal to the greater of the two types. @@ -1076,11 +1076,11 @@ Some helper methods are then defined in terms of this low-level [`order()`](#qis ``` -#### Casting between types +### 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 [`types`](https://docs.python.org/3/library/types.html#module-types "(in Python v3.12)") module. You can query the casting kinds using [`cast_kind()`](#qiskit.circuit.classical.types.cast_kind "qiskit.circuit.classical.types.cast_kind"): -##### cast\_kind +#### cast\_kind Determine the sort of cast that is required to move from the left type to the right type. @@ -1106,7 +1106,7 @@ It is common to need to cast values of one type to another type. The casting rul The return values from this function are an enumeration explaining the types of cast that are allowed from the left type to the right type. -##### CastKind +#### CastKind A return value indicating the type of cast that can occur from one type to another. diff --git a/docs/api/qiskit/dev/circuit_library.mdx b/docs/api/qiskit/dev/circuit_library.mdx index c19df7e505e..78306b93839 100644 --- a/docs/api/qiskit/dev/circuit_library.mdx +++ b/docs/api/qiskit/dev/circuit_library.mdx @@ -122,18 +122,14 @@ print(gate.control(1).to_matrix()) # CX (controlled X) gate 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. -| | | -| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Barrier`(num\_qubits\[, label]) | A directive for circuit compilation to separate pieces of a circuit so that any optimizations or re-writes are constrained to only act between barriers. | +* [`qiskit.circuit.Barrier`](circuit#qiskit.circuit.Barrier "qiskit.circuit.Barrier") ## Standard Operations Operations are non-reversible changes in the quantum state of the circuit. -| | | -| -------------------------------------- | --------------------------------------------------------- | -| `Measure`(\*args\[, \_force\_mutable]) | Quantum measurement in the computational basis. | -| `Reset`(\*args\[, \_force\_mutable]) | Incoherently reset a qubit to the $\lvert0\rangle$ state. | +* [`qiskit.circuit.Measure`](circuit#qiskit.circuit.Measure "qiskit.circuit.Measure") +* [`qiskit.circuit.Reset`](circuit#qiskit.circuit.Reset "qiskit.circuit.Reset") ## Generalized Gates diff --git a/docs/api/qiskit/dev/classicalfunction.mdx b/docs/api/qiskit/dev/classicalfunction.mdx index 2283ac9ce87..ade7aed1495 100644 --- a/docs/api/qiskit/dev/classicalfunction.mdx +++ b/docs/api/qiskit/dev/classicalfunction.mdx @@ -67,6 +67,24 @@ The type `Int1` means the classical function will only operate at bit level. Decorator for a classical function that returns a ClassicalFunction object. +#### classical\_function + + + Parses and type checks the callable `func` to compile it into an `ClassicalFunction` that can be synthesized into a `QuantumCircuit`. + + **Parameters** + + **func** (*callable*) – A callable (with type hints) to compile into an `ClassicalFunction`. + + **Returns** + + An object that can synthesis into a QuantumCircuit (via `synth()` method). + + **Return type** + + [ClassicalFunction](qiskit.circuit.classicalfunction.ClassicalFunction "qiskit.circuit.classicalfunction.ClassicalFunction") + + ### ClassicalFunction | | | diff --git a/docs/api/qiskit/dev/converters.mdx b/docs/api/qiskit/dev/converters.mdx index 75cf0e6fab2..708c1ee730f 100644 --- a/docs/api/qiskit/dev/converters.mdx +++ b/docs/api/qiskit/dev/converters.mdx @@ -18,6 +18,84 @@ python_api_name: qiskit.converters `qiskit.converters` + + +## QuantumCircuit -> circuit components + +### circuit\_to\_instruction + + + Build an [`Instruction`](qiskit.circuit.Instruction "qiskit.circuit.Instruction") object from a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"). + + The instruction is anonymous (not tied to a named quantum register), and so can be inserted into another circuit. The instruction will have the same string name as the circuit. + + **Parameters** + + * **circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) – the input circuit. + * **parameter\_map** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")) – For parameterized circuits, a mapping from parameters in the circuit to parameters to be used in the instruction. If None, existing circuit parameters will also parameterize the instruction. + * **equivalence\_library** ([*EquivalenceLibrary*](qiskit.circuit.EquivalenceLibrary "qiskit.circuit.EquivalenceLibrary")) – Optional equivalence library where the converted instruction will be registered. + * **label** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) – Optional instruction label. + + **Raises** + + [**QiskitError**](exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if parameter\_map is not compatible with circuit + + **Returns** + + an instruction equivalent to the action of the input circuit. Upon decomposition, this instruction will yield the components comprising the original circuit. + + **Return type** + + [qiskit.circuit.Instruction](qiskit.circuit.Instruction "qiskit.circuit.Instruction") + + **Example** + + ```python + from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit + from qiskit.converters import circuit_to_instruction + + q = QuantumRegister(3, 'q') + c = ClassicalRegister(3, 'c') + circ = QuantumCircuit(q, c) + circ.h(q[0]) + circ.cx(q[0], q[1]) + circ.measure(q[0], c[0]) + circ.rz(0.5, q[1]).c_if(c, 2) + circuit_to_instruction(circ) + ``` + + +### circuit\_to\_gate + + + Build a [`Gate`](qiskit.circuit.Gate "qiskit.circuit.Gate") object from a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"). + + The gate is anonymous (not tied to a named quantum register), and so can be inserted into another circuit. The gate will have the same string name as the circuit. + + **Parameters** + + * **circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) – the input circuit. + * **parameter\_map** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")) – For parameterized circuits, a mapping from parameters in the circuit to parameters to be used in the gate. If None, existing circuit parameters will also parameterize the Gate. + * **equivalence\_library** ([*EquivalenceLibrary*](qiskit.circuit.EquivalenceLibrary "qiskit.circuit.EquivalenceLibrary")) – Optional equivalence library where the converted gate will be registered. + * **label** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) – Optional gate label. + + **Raises** + + [**QiskitError**](exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if circuit is non-unitary or if parameter\_map is not compatible with circuit + + **Returns** + + a Gate equivalent to the action of the input circuit. Upon decomposition, this gate will yield the components comprising the original circuit. + + **Return type** + + [Gate](qiskit.circuit.Gate "qiskit.circuit.Gate") + + + + +## QuantumCircuit \<-> DagCircuit + ### circuit\_to\_dag @@ -102,75 +180,9 @@ python_api_name: qiskit.converters ![../\_images/converters-1.png](/images/api/qiskit/dev/converters-1.png) -### circuit\_to\_instruction - - - Build an [`Instruction`](qiskit.circuit.Instruction "qiskit.circuit.Instruction") object from a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"). - - The instruction is anonymous (not tied to a named quantum register), and so can be inserted into another circuit. The instruction will have the same string name as the circuit. - - **Parameters** - - * **circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) – the input circuit. - * **parameter\_map** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")) – For parameterized circuits, a mapping from parameters in the circuit to parameters to be used in the instruction. If None, existing circuit parameters will also parameterize the instruction. - * **equivalence\_library** ([*EquivalenceLibrary*](qiskit.circuit.EquivalenceLibrary "qiskit.circuit.EquivalenceLibrary")) – Optional equivalence library where the converted instruction will be registered. - * **label** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) – Optional instruction label. - - **Raises** - - [**QiskitError**](exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if parameter\_map is not compatible with circuit - - **Returns** - - an instruction equivalent to the action of the input circuit. Upon decomposition, this instruction will yield the components comprising the original circuit. - - **Return type** - - [qiskit.circuit.Instruction](qiskit.circuit.Instruction "qiskit.circuit.Instruction") - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - from qiskit.converters import circuit_to_instruction - - q = QuantumRegister(3, 'q') - c = ClassicalRegister(3, 'c') - circ = QuantumCircuit(q, c) - circ.h(q[0]) - circ.cx(q[0], q[1]) - circ.measure(q[0], c[0]) - circ.rz(0.5, q[1]).c_if(c, 2) - circuit_to_instruction(circ) - ``` - - -### circuit\_to\_gate - - - Build a [`Gate`](qiskit.circuit.Gate "qiskit.circuit.Gate") object from a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"). - - The gate is anonymous (not tied to a named quantum register), and so can be inserted into another circuit. The gate will have the same string name as the circuit. - - **Parameters** - - * **circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) – the input circuit. - * **parameter\_map** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.12)")) – For parameterized circuits, a mapping from parameters in the circuit to parameters to be used in the gate. If None, existing circuit parameters will also parameterize the Gate. - * **equivalence\_library** ([*EquivalenceLibrary*](qiskit.circuit.EquivalenceLibrary "qiskit.circuit.EquivalenceLibrary")) – Optional equivalence library where the converted gate will be registered. - * **label** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) – Optional gate label. - - **Raises** - - [**QiskitError**](exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if circuit is non-unitary or if parameter\_map is not compatible with circuit - - **Returns** + - a Gate equivalent to the action of the input circuit. Upon decomposition, this gate will yield the components comprising the original circuit. - - **Return type** - - [Gate](qiskit.circuit.Gate "qiskit.circuit.Gate") - +## QuantumCircuit \<-> DagDependency ### dagdependency\_to\_circuit @@ -209,6 +221,10 @@ python_api_name: qiskit.converters [DAGDependency](qiskit.dagcircuit.DAGDependency "qiskit.dagcircuit.DAGDependency") + + +## DagCircuit \<-> DagDependency + ### dag\_to\_dagdependency diff --git a/docs/api/qiskit/dev/index.mdx b/docs/api/qiskit/dev/index.mdx index 673a3f67032..a00706cc213 100644 --- a/docs/api/qiskit/dev/index.mdx +++ b/docs/api/qiskit/dev/index.mdx @@ -10,38 +10,60 @@ python_api_name: qiskit # API Reference +Circuit construction: + * [Quantum circuit model (`qiskit.circuit`)](circuit) -* [Circuit Library (`qiskit.circuit.library`)](circuit_library) * [Classical expressions (`qiskit.circuit.classical`)](circuit_classical) -* [Singleton instructions (`qiskit.circuit.singleton`)](circuit_singleton) -* [Compilation Routines (`qiskit.compiler`)](compiler) -* [Visualizations (`qiskit.visualization`)](visualization) * [ClassicalFunction compiler (`qiskit.circuit.classicalfunction`)](classicalfunction) +* [Circuit Library (`qiskit.circuit.library`)](circuit_library) +* [Singleton instructions (`qiskit.circuit.singleton`)](circuit_singleton) + +Quantum information: + +* [Quantum Information (`qiskit.quantum_info`)](quantum_info) + +Transpilation: + * [Circuit Converters (`qiskit.converters`)](converters) -* [Circuit and Schedule Assembler (`qiskit.assembler`)](assembler) * [DAG Circuits (`qiskit.dagcircuit`)](dagcircuit) * [Passmanager (`qiskit.passmanager`)](passmanager) +* [Circuit Synthesis (`qiskit.synthesis`)](synthesis) +* [Approximate Quantum Compiler (`qiskit.synthesis.unitary.aqc`)](qiskit.synthesis.unitary.aqc) +* [Transpiler (`qiskit.transpiler`)](transpiler) +* [Transpiler Passes (`qiskit.transpiler.passes`)](transpiler_passes) +* [Synthesis Plugins (`qiskit.transpiler.passes.synthesis.plugin`)](transpiler_synthesis_plugins) +* [Preset Passmanagers (`qiskit.transpiler.preset_passmanagers`)](transpiler_preset) +* [Transpiler Stage Plugin Interface (`qiskit.transpiler.preset_passmanagers.plugin`)](transpiler_plugins) + +Primitives and providers: + +* [Primitives (`qiskit.primitives`)](primitives) * [Providers Interface (`qiskit.providers`)](providers) -* [Writing a New Backend](providers#writing-a-new-backend) -* [Migrating between Backend API Versions](providers#migrating-between-backend-api-versions) * [BasicProvider: Python-based Simulators (`qiskit.providers.basic_provider`)](providers_basic_provider) * [Fake Provider (`qiskit.providers.fake_provider`)](providers_fake_provider) * [Backend Objects (`qiskit.providers.models`)](providers_models) -* [Pulse (`qiskit.pulse`)](pulse) -* [Circuit Scheduler (`qiskit.scheduler`)](scheduler) -* [Circuit Synthesis (`qiskit.synthesis`)](synthesis) -* [Primitives (`qiskit.primitives`)](primitives) + +Results and visualizations: + +* [Experiment Results (`qiskit.result`)](result) +* [Visualizations (`qiskit.visualization`)](visualization) + +Serialization: + * [OpenQASM 2 (`qiskit.qasm2`)](qasm2) * [OpenQASM 3 (`qiskit.qasm3`)](qasm3) -* [Qobj (`qiskit.qobj`)](qobj) * [QPY serialization (`qiskit.qpy`)](qpy) -* [Quantum Information (`qiskit.quantum_info`)](quantum_info) -* [Experiment Results (`qiskit.result`)](result) -* [Transpiler (`qiskit.transpiler`)](transpiler) -* [Transpiler Passes (`qiskit.transpiler.passes`)](transpiler_passes) -* [Preset Passmanagers (`qiskit.transpiler.preset_passmanagers`)](transpiler_preset) -* [Transpiler Stage Plugin Interface (`qiskit.transpiler.preset_passmanagers.plugin`)](transpiler_plugins) -* [Synthesis Plugins (`qiskit.transpiler.passes.synthesis.plugin`)](transpiler_synthesis_plugins) -* [Utilities (`qiskit.utils`)](utils) + +Pulse-level programming: + +* [Pulse (`qiskit.pulse`)](pulse) +* [Circuit Scheduler (`qiskit.scheduler`)](scheduler) + +Other: + +* [Circuit and Schedule Assembler (`qiskit.assembler`)](assembler) +* [Compilation Routines (`qiskit.compiler`)](compiler) * [Top-level exceptions (`qiskit.exceptions`)](exceptions) +* [Qobj (`qiskit.qobj`)](qobj) +* [Utilities (`qiskit.utils`)](utils) diff --git a/docs/api/qiskit/dev/providers.mdx b/docs/api/qiskit/dev/providers.mdx index f78eaadea77..0f7ddfa3338 100644 --- a/docs/api/qiskit/dev/providers.mdx +++ b/docs/api/qiskit/dev/providers.mdx @@ -115,7 +115,7 @@ It’s worth pointing out that Qiskit’s version support policy doesn’t mean Set the error message. -# Writing a New Backend +## Writing a New Backend If you have a quantum device or simulator that you would like to integrate with Qiskit you will need to write a backend. A provider is a collection of backends and will provide Qiskit with a method to get available [`BackendV2`](qiskit.providers.BackendV2 "qiskit.providers.BackendV2") objects. The [`BackendV2`](qiskit.providers.BackendV2 "qiskit.providers.BackendV2") object provides both information describing a backend and its operation for the [`transpiler`](transpiler#module-qiskit.transpiler "qiskit.transpiler") so that circuits can be compiled to something that is optimized and can execute on the backend. It also provides the [`run()`](qiskit.providers.BackendV2#run "qiskit.providers.BackendV2.run") method which can run the [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") objects and/or [`Schedule`](qiskit.pulse.Schedule "qiskit.pulse.Schedule") objects. This enables users and other Qiskit APIs to get results from executing circuits on devices in a standard fashion regardless of how the backend is implemented. At a high level the basic steps for writing a provider are: @@ -131,7 +131,7 @@ For a simple example of a provider, see the [qiskit-aqt-provider](https://github -## Provider +### Provider A provider class serves a single purpose: to get backend objects that enable executing circuits on a device or simulator. The expectation is that any required credentials and/or authentication will be handled in the initialization of a provider object. The provider object will then provide a list of backends, and methods to filter and acquire backends (using the provided credentials if required). An example provider class looks like: @@ -158,7 +158,7 @@ Ensure that any necessary information for authentication (if required) are prese -## Backend +### Backend The backend classes are the core to the provider. These classes are what provide the interface between Qiskit and the hardware or simulator that will execute circuits. This includes providing the necessary information to describe a backend to the compiler so that it can embed and optimize any circuit for the backend. There are 4 required things in every backend object: a [`target`](qiskit.providers.BackendV2#target "qiskit.providers.BackendV2.target") property to define the model of the backend for the compiler, a [`max_circuits`](qiskit.providers.BackendV2#max_circuits "qiskit.providers.BackendV2.max_circuits") property to define a limit on the number of circuits the backend can execute in a single batch job (if there is no limit `None` can be used), a [`run()`](qiskit.providers.BackendV2#run "qiskit.providers.BackendV2.run") method to accept job submissions, and a [`_default_options`](qiskit.providers.BackendV2#_default_options "qiskit.providers.BackendV2._default_options") method to define the user configurable options and their default values. For example, a minimum working example would be something like: @@ -228,7 +228,9 @@ class Mybackend(Backend): return MyJob(self. job_handle, job_json, circuit) ``` -### Transpiler Interface + + +### Backend’s Transpiler Interface The key piece of the [`Backend`](qiskit.providers.Backend "qiskit.providers.Backend") object is how it describes itself to the compiler. This is handled with the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") class which defines a model of a backend for the transpiler. A backend object will need to return a [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") object from the [`target`](qiskit.providers.BackendV2#target "qiskit.providers.BackendV2.target") attribute which the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function will use as its model of a backend target for compilation. @@ -330,7 +332,9 @@ This snippet of a backend implementation will now have the [`transpile()`](compi This way if these two compilation steps are **required** for running or providing efficient output on `Mybackend` the transpiler will be able to perform these custom steps without any manual user input. -### Run Method + + +### Backend.run Method Of key importance is the [`run()`](qiskit.providers.BackendV2#run "qiskit.providers.BackendV2.run") method, which is used to actually submit circuits to a device or simulator. The run method handles submitting the circuits to the backend to be executed and returning a [`Job`](qiskit.providers.Job "qiskit.providers.Job") object. Depending on the type of backend this typically involves serializing the circuit object into the API format used by a backend. For example, on IBM backends from the `qiskit-ibm-provider` package this involves converting from a quantum circuit and options into a [`qpy`](qpy#module-qiskit.qpy "qiskit.qpy") payload embedded in JSON and submitting that to the IBM Quantum API. Since every backend interface is different (and in the case of the local simulators serialization may not be needed) it is expected that the backend’s [`run`](qiskit.providers.BackendV2#run "qiskit.providers.BackendV2.run") method will handle this conversion. @@ -352,9 +356,7 @@ def run(self, circuits. **kwargs): return MyJob(self. job_handle, job_json, circuit) ``` - - -### Options +### Backend Options There are often several options for a backend that control how a circuit is run. The typical example of this is something like the number of `shots` which is how many times the circuit is to be executed. The options available for a backend are defined using an [`Options`](qiskit.providers.Options "qiskit.providers.Options") object. This object is initially created by the [`_default_options`](qiskit.providers.BackendV2#_default_options "qiskit.providers.BackendV2._default_options") method of a Backend class. The default options returns an initialized [`Options`](qiskit.providers.Options "qiskit.providers.Options") object with all the default values for all the options a backend supports. For example, if the backend supports only supports `shots` the [`_default_options`](qiskit.providers.BackendV2#_default_options "qiskit.providers.BackendV2._default_options") method would look like: @@ -372,9 +374,9 @@ self.options.set_validator("shots", (1, 4096)) you can refer to the [`set_validator()`](qiskit.providers.Options#set_validator "qiskit.providers.Options.set_validator") documentation for a full list of validation options. - + -## Job +### Job The output from the [`run`](qiskit.providers.BackendV2#run "qiskit.providers.BackendV2.run") method is a [`JobV1`](qiskit.providers.JobV1 "qiskit.providers.JobV1") object. Each provider is expected to implement a custom job subclass that defines the behavior for the provider. There are 2 types of jobs depending on the backend’s execution method, either a sync or async. By default jobs are considered async and the expectation is that it represents a handle to the async execution of the circuits submitted with `Backend.run()`. An async job object provides users the ability to query the status of the execution, cancel a running job, and block until the execution is finished. The [`result`](qiskit.providers.JobV1#result "qiskit.providers.JobV1.result") is the primary user facing method which will block until the execution is complete and then will return a [`Result`](qiskit.result.Result "qiskit.result.Result") object with results of the job. @@ -459,17 +461,13 @@ class MySyncJob(Job): return JobStatus.DONE ``` -## Primitives +### Primitives While not directly part of the provider interface, the [`qiskit.primitives`](primitives#module-qiskit.primitives "qiskit.primitives") module is tightly coupled with providers. Specifically the primitive interfaces, such as `BaseSampler` and `BaseEstimator`, are designed to enable provider implementations to provide custom implementations which are optimized for the provider’s backends. This can include customizations like circuit transformations, additional pre- and post-processing, batching, caching, error mitigation, etc. The concept of the [`qiskit.primitives`](primitives#module-qiskit.primitives "qiskit.primitives") module is to explicitly enable this as the primitive objects are higher level abstractions to produce processed higher level outputs (such as probability distributions and expectation values) that abstract away the mechanics of getting the best result efficiently, to concentrate on higher level applications using these outputs. For example, if your backends were well suited to leverage [mthree](https://github.com/Qiskit-Partners/mthree/) measurement mitigation to improve the quality of the results, you could implement a provider-specific [`Sampler`](qiskit.primitives.Sampler "qiskit.primitives.Sampler") implementation that leverages the `M3Mitigation` class internally to run the circuits and return quasi-probabilities directly from mthree in the result. Doing this would enable algorithms to get the best results with mitigation applied directly from your backends. You can refer to the documentation in [`qiskit.primitives`](primitives#module-qiskit.primitives "qiskit.primitives") on how to write custom implementations. Also the built-in implementations: [`Sampler`](qiskit.primitives.Sampler "qiskit.primitives.Sampler"), [`Estimator`](qiskit.primitives.Estimator "qiskit.primitives.Estimator"), [`BackendSampler`](qiskit.primitives.BackendSampler "qiskit.primitives.BackendSampler"), and [`BackendEstimator`](qiskit.primitives.BackendEstimator "qiskit.primitives.BackendEstimator") can serve as references/models on how to implement these as well. -# Migrating between Backend API Versions - - - -## BackendV1 -> BackendV2 +## Migrating from BackendV1 to BackendV2 The [`BackendV2`](qiskit.providers.BackendV2 "qiskit.providers.BackendV2") class re-defined user access for most properties of a backend to make them work with native Qiskit data structures and have flatter access patterns. However this means when using a provider that upgrades from [`BackendV1`](qiskit.providers.BackendV1 "qiskit.providers.BackendV1") to [`BackendV2`](qiskit.providers.BackendV2 "qiskit.providers.BackendV2") existing access patterns will need to be adjusted. It is expected for existing providers to deprecate the old access where possible to provide a graceful migration, but eventually users will need to adjust code. The biggest change to adapt to in [`BackendV2`](qiskit.providers.BackendV2 "qiskit.providers.BackendV2") is that most of the information accessible about a backend is contained in its [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") object and the backend’s attributes often query its [`target`](qiskit.providers.BackendV2#target "qiskit.providers.BackendV2.target") attribute to return information, however in many cases the attributes only provide a subset of information the target can contain. For example, `backend.coupling_map` returns a [`CouplingMap`](qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap") constructed from the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") accessible in the [`target`](qiskit.providers.BackendV2#target "qiskit.providers.BackendV2.target") attribute, however the target may contain instructions that operate on more than two qubits (which can’t be represented in a [`CouplingMap`](qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap")) or has instructions that only operate on a subset of qubits (or two qubit links for a two qubit instruction) which won’t be detailed in the full coupling map returned by [`coupling_map`](qiskit.providers.BackendV2#coupling_map "qiskit.providers.BackendV2.coupling_map"). So depending on your use case it might be necessary to look deeper than just the equivalent access with [`BackendV2`](qiskit.providers.BackendV2 "qiskit.providers.BackendV2"). diff --git a/docs/api/qiskit/dev/providers_basic_provider.mdx b/docs/api/qiskit/dev/providers_basic_provider.mdx index eb5dc6f06c2..4054b9af33a 100644 --- a/docs/api/qiskit/dev/providers_basic_provider.mdx +++ b/docs/api/qiskit/dev/providers_basic_provider.mdx @@ -26,27 +26,12 @@ from qiskit.providers.basic_provider import BasicProvider backend = BasicProvider().get_backend('basic_simulator') ``` -## Simulators - -| | | -| ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | -| [`BasicSimulator`](qiskit.providers.basic_provider.BasicSimulator "qiskit.providers.basic_provider.BasicSimulator")(\[provider, target]) | Python implementation of a basic (non-efficient) quantum simulator. | - -## Provider - -| | | -| ------------------------------------------------------------------------------------------------------------------ | ----------------------------- | -| [`BasicProvider`](qiskit.providers.basic_provider.BasicProvider "qiskit.providers.basic_provider.BasicProvider")() | Provider for test simulators. | - -## Job Class - -| | | -| --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | -| [`BasicProviderJob`](qiskit.providers.basic_provider.BasicProviderJob "qiskit.providers.basic_provider.BasicProviderJob")(backend, job\_id, result) | BasicProviderJob class. | - -## Exceptions - -| | | -| ------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------- | -| [`BasicProviderError`](qiskit.providers.basic_provider.BasicProviderError "qiskit.providers.basic_provider.BasicProviderError")(\*message) | Base class for errors raised by the Basic Provider. | +## Classes + +| | | +| --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | +| [`BasicSimulator`](qiskit.providers.basic_provider.BasicSimulator "qiskit.providers.basic_provider.BasicSimulator")(\[provider, target]) | Python implementation of a basic (non-efficient) quantum simulator. | +| [`BasicProvider`](qiskit.providers.basic_provider.BasicProvider "qiskit.providers.basic_provider.BasicProvider")() | Provider for test simulators. | +| [`BasicProviderJob`](qiskit.providers.basic_provider.BasicProviderJob "qiskit.providers.basic_provider.BasicProviderJob")(backend, job\_id, result) | BasicProviderJob class. | +| [`BasicProviderError`](qiskit.providers.basic_provider.BasicProviderError "qiskit.providers.basic_provider.BasicProviderError")(\*message) | Base class for errors raised by the Basic Provider. | diff --git a/docs/api/qiskit/dev/providers_fake_provider.mdx b/docs/api/qiskit/dev/providers_fake_provider.mdx index 32e80976b8e..60b83fa3b06 100644 --- a/docs/api/qiskit/dev/providers_fake_provider.mdx +++ b/docs/api/qiskit/dev/providers_fake_provider.mdx @@ -22,7 +22,7 @@ python_api_name: qiskit.providers.fake_provider The fake provider module in Qiskit contains fake (simulated) backend classes useful for testing the transpiler and other backend-facing functionality. -## Example Usage +### Example Usage Here is an example of using a simulated backend for transpilation and running. diff --git a/docs/api/qiskit/dev/providers_models.mdx b/docs/api/qiskit/dev/providers_models.mdx index d707ddeb624..3f4f7b13266 100644 --- a/docs/api/qiskit/dev/providers_models.mdx +++ b/docs/api/qiskit/dev/providers_models.mdx @@ -20,7 +20,7 @@ python_api_name: qiskit.providers.models Qiskit schema-conformant objects used by the backends and providers. -## Backend Objects +## Classes | | | | -------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | diff --git a/docs/api/qiskit/dev/qiskit.circuit.QuantumCircuit.mdx b/docs/api/qiskit/dev/qiskit.circuit.QuantumCircuit.mdx index ec24327c5c0..4cfa2058d03 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.QuantumCircuit.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.QuantumCircuit.mdx @@ -153,7 +153,7 @@ python_api_name: qiskit.circuit.QuantumCircuit ### instances - + ### layout diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.AND.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.AND.mdx index aede3273d58..4a05cb65fbb 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.AND.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.AND.mdx @@ -75,7 +75,7 @@ python_api_name: qiskit.circuit.library.AND ### instances - + ### layout diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.CDKMRippleCarryAdder.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.CDKMRippleCarryAdder.mdx index dca1d3fbf82..3aaeb23313f 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.CDKMRippleCarryAdder.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.CDKMRippleCarryAdder.mdx @@ -121,7 +121,7 @@ python_api_name: qiskit.circuit.library.CDKMRippleCarryAdder ### instances - + ### layout diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.QuantumVolume.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.QuantumVolume.mdx index d14981c6f12..370f75a9be8 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.QuantumVolume.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.QuantumVolume.mdx @@ -83,7 +83,7 @@ python_api_name: qiskit.circuit.library.QuantumVolume ### instances - + ### layout diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.RGQFTMultiplier.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.RGQFTMultiplier.mdx index e30e97a3a1f..08141971733 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.RGQFTMultiplier.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.RGQFTMultiplier.mdx @@ -84,7 +84,7 @@ python_api_name: qiskit.circuit.library.RGQFTMultiplier ### instances - + ### layout diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.RealAmplitudes.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.RealAmplitudes.mdx index eba87296d5a..62a528449b7 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.RealAmplitudes.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.RealAmplitudes.mdx @@ -192,7 +192,7 @@ python_api_name: qiskit.circuit.library.RealAmplitudes ### instances - + ### layout diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.TwoLocal.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.TwoLocal.mdx index 9fe75fcf131..58f3c27c21d 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.TwoLocal.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.TwoLocal.mdx @@ -204,7 +204,7 @@ python_api_name: qiskit.circuit.library.TwoLocal ### instances - + ### layout diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.UnitaryOverlap.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.UnitaryOverlap.mdx index 964bae92ae4..1d094e21faf 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.UnitaryOverlap.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.UnitaryOverlap.mdx @@ -102,7 +102,7 @@ $$ ### instances - + ### layout diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.VBERippleCarryAdder.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.VBERippleCarryAdder.mdx index 18a64ec6b49..28d3977a4d2 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.VBERippleCarryAdder.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.VBERippleCarryAdder.mdx @@ -93,7 +93,7 @@ python_api_name: qiskit.circuit.library.VBERippleCarryAdder ### instances - + ### layout diff --git a/docs/api/qiskit/dev/qiskit.quantum_info.Pauli.mdx b/docs/api/qiskit/dev/qiskit.quantum_info.Pauli.mdx index 9e59b0267c1..5f06ff8f702 100644 --- a/docs/api/qiskit/dev/qiskit.quantum_info.Pauli.mdx +++ b/docs/api/qiskit/dev/qiskit.quantum_info.Pauli.mdx @@ -88,13 +88,13 @@ $$ For example ```python - p = Pauli('-iXYZ') + P = Pauli('-iXYZ') print('P[0] =', repr(P[0])) print('P[1] =', repr(P[1])) print('P[2] =', repr(P[2])) print('P[:] =', repr(P[:])) - print('P[::-1] =, repr(P[::-1])) + print('P[::-1] =', repr(P[::-1])) ``` Initialize the Pauli. diff --git a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.mdx b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.mdx index 6fa514a6271..dd3162bb2ba 100644 --- a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.mdx +++ b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.mdx @@ -10,11 +10,9 @@ python_api_name: qiskit.synthesis.unitary.aqc -# qiskit.synthesis.unitary.aqc - -## Approximate Quantum Compiler +# Approximate Quantum Compiler @@ -22,7 +20,7 @@ python_api_name: qiskit.synthesis.unitary.aqc Implementation of Approximate Quantum Compiler as described in the paper \[1]. -### Interface +## Interface The main public interface of this module is reached by passing `unitary_synthesis_method='aqc'` to [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile"). This will swap the synthesis method to use `AQCSynthesisPlugin`. The individual classes are: @@ -36,7 +34,7 @@ The main public interface of this module is reached by passing `unitary_synthesi | [`DefaultCNOTUnitObjective`](qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective "qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective")(num\_qubits, cnots) | A naive implementation of the objective function based on CNOT units. | | [`FastCNOTUnitObjective`](qiskit.synthesis.unitary.aqc.FastCNOTUnitObjective "qiskit.synthesis.unitary.aqc.FastCNOTUnitObjective")(num\_qubits, cnots) | Implementation of objective function and gradient calculator, which is similar to `DefaultCNOTUnitObjective` but several times faster. | -### Mathematical Detail +## Mathematical Detail We are interested in compiling a quantum circuit, which we formalize as finding the best circuit representation in terms of an ordered gate sequence of a target unitary matrix $U\in U(d)$, with some additional hardware constraints. In particular, we look at representations that could be constrained in terms of hardware connectivity, as well as gate depth, and we choose a gate basis in terms of CNOT and rotation gates. We recall that the combination of CNOT and rotation gates is universal in $SU(d)$ and therefore it does not limit compilation. @@ -127,7 +125,7 @@ Now `approximate_circuit` is a circuit that approximates the target unitary to a This uses a helper function, [`make_cnot_network`](#qiskit.synthesis.unitary.aqc.make_cnot_network "qiskit.synthesis.unitary.aqc.make_cnot_network"). -#### make\_cnot\_network +### make\_cnot\_network Generates a network consisting of building blocks each containing a CNOT gate and possibly some single-qubit ones. This network models a quantum operator in question. Note, each building block has 2 input and outputs corresponding to a pair of qubits. What we actually return here is a chain of indices of qubit pairs shared by every building block in a row. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.Commuting2qGateRouter.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.Commuting2qGateRouter.mdx index f736e5a94f1..8cb12073e7b 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.Commuting2qGateRouter.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.Commuting2qGateRouter.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.Commuting2qGateRouter # Commuting2qGateRouter - + Bases: [`TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.basepasses.TransformationPass") A class to swap route one or more commuting gates to the coupling map. @@ -127,7 +127,7 @@ python_api_name: qiskit.transpiler.passes.Commuting2qGateRouter ### run - + Run the pass by decomposing the nodes it applies on. **Parameters** @@ -151,7 +151,7 @@ python_api_name: qiskit.transpiler.passes.Commuting2qGateRouter ### swap\_decompose - + Take an instance of `Commuting2qBlock` and map it to the coupling map. The mapping is done with the swap strategy. diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_circuit_layout.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_circuit_layout.mdx index b9da79588ee..5741b941f02 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_circuit_layout.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_circuit_layout.mdx @@ -10,14 +10,22 @@ python_api_name: qiskit.visualization.plot_circuit_layout # qiskit.visualization.plot\_circuit\_layout - + Plot the layout of a circuit transpiled for a given target backend. **Parameters** * **circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) – Input quantum circuit. + * **backend** ([*Backend*](qiskit.providers.Backend "qiskit.providers.Backend")) – Target backend. - * **view** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) – Layout view: either ‘virtual’ or ‘physical’. + + * **view** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) – + + How to label qubits in the layout. Options: + + * `"virtual"`: Label each qubit with the index of the virtual qubit that mapped to it. + * `"physical"`: Label each qubit with the index of the physical qubit that it corresponds to on the device. + * **qubit\_coordinates** (*Sequence*) – An optional sequence input (list or array being the most common) of 2d coordinates for each qubit. The length of the sequence must match the number of qubits on the backend. The sequence should be the planar coordinates in a 0-based square grid where each qubit is located. **Returns** diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_error_map.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_error_map.mdx index b23a66a377c..5b04931d035 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_error_map.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_error_map.mdx @@ -10,7 +10,7 @@ python_api_name: qiskit.visualization.plot_error_map # qiskit.visualization.plot\_error\_map - + Plots the error map of a given backend. **Parameters** diff --git a/docs/api/qiskit/dev/qpy.mdx b/docs/api/qiskit/dev/qpy.mdx index 00626bd45a8..f10c435f19e 100644 --- a/docs/api/qiskit/dev/qpy.mdx +++ b/docs/api/qiskit/dev/qpy.mdx @@ -20,7 +20,7 @@ python_api_name: qiskit.qpy QPY is a binary serialization format for [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") and [`ScheduleBlock`](qiskit.pulse.ScheduleBlock "qiskit.pulse.ScheduleBlock") objects that is designed to be cross-platform, Python version agnostic, and backwards compatible moving forward. QPY should be used if you need a mechanism to save or copy between systems a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") or [`ScheduleBlock`](qiskit.pulse.ScheduleBlock "qiskit.pulse.ScheduleBlock") that preserves the full Qiskit object structure (except for custom attributes defined outside of Qiskit code). This differs from other serialization formats like [OpenQASM](https://github.com/openqasm/openqasm) (2.0 or 3.0) which has a different abstraction model and can result in a loss of information contained in the original circuit (or is unable to represent some aspects of the Qiskit objects) or Python’s [pickle](https://docs.python.org/3/library/pickle.html) which will preserve the Qiskit object exactly but will only work for a single Qiskit version (it is also [potentially insecure](https://docs.python.org/3/library/pickle.html#module-pickle)). -## Using QPY +## Basic Usage Using QPY is defined to be straightforward and mirror the user API of the serializers in Python’s standard library, `pickle` and `json`. There are 2 user facing functions: [`qiskit.qpy.dump()`](#qiskit.qpy.dump "qiskit.qpy.dump") and [`qiskit.qpy.load()`](#qiskit.qpy.load "qiskit.qpy.load") which are used to dump QPY data to a file object and load circuits from QPY data in a file object respectively. For example: @@ -53,9 +53,9 @@ and then loading that file will return a list with all the circuits > > twenty\_new\_bells = qpy.load(fd) -### API documentation +## API documentation -#### load +### load Load a QPY binary file @@ -100,7 +100,7 @@ and then loading that file will return a list with all the circuits [*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.12)")\[[*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit") | [*ScheduleBlock*](qiskit.pulse.ScheduleBlock "qiskit.pulse.schedule.ScheduleBlock")] -#### dump +### dump Write QPY binary data to a file @@ -164,7 +164,7 @@ and then loading that file will return a list with all the circuits These functions will raise a custom subclass of [`QiskitError`](exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") if they encounter problems during serialization or deserialization. -#### QpyError +### QpyError Errors raised by the qpy module. @@ -174,7 +174,7 @@ These functions will raise a custom subclass of [`QiskitError`](exceptions#qiski When a lower-than-maximum target QPY version is set for serialization, but the object to be serialized contains features that cannot be represented in that format, a subclass of [`QpyError`](#qiskit.qpy.QpyError "qiskit.qpy.QpyError") is raised: -#### UnsupportedFeatureForVersion +### UnsupportedFeatureForVersion QPY error raised when the target dump version is too low for a feature that is present in the object to be serialized. @@ -186,7 +186,7 @@ When a lower-than-maximum target QPY version is set for serialization, but the o * **target** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) – the version of QPY that is being used in the serialization. -#### qiskit.qpy.QPY\_VERSION +### qiskit.qpy.QPY\_VERSION The current QPY format version as of this release. This is the default value of the `version` keyword argument on [`qpy.dump()`](#qiskit.qpy.dump "qiskit.qpy.dump") and also the upper bound for accepted values for the same argument. This is also the upper bond on the versions supported by [`qpy.load()`](#qiskit.qpy.load "qiskit.qpy.load"). @@ -196,7 +196,7 @@ When a lower-than-maximum target QPY version is set for serialization, but the o [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)") -#### qiskit.qpy.QPY\_COMPATIBILITY\_VERSION +### qiskit.qpy.QPY\_COMPATIBILITY\_VERSION The current minimum compatibility QPY format version. This is the minimum version that [`qpy.dump()`](#qiskit.qpy.dump "qiskit.qpy.dump") will accept for the `version` keyword argument. [`qpy.load()`](#qiskit.qpy.load "qiskit.qpy.load") will be able to load all released format versions of QPY (up until `QPY_VERSION`). @@ -206,7 +206,7 @@ When a lower-than-maximum target QPY version is set for serialization, but the o [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)") -### QPY Compatibility +## QPY Compatibility The QPY format is designed to be backwards compatible moving forward. This means you should be able to load a QPY with any newer Qiskit version than the one that generated it. However, loading a QPY file with an older Qiskit version is not supported and may not work. @@ -214,13 +214,13 @@ For example, if you generated a QPY file using qiskit-terra 0.18.1 you could loa If a feature being loaded is deprecated in the corresponding qiskit release, QPY will raise a [`QPYLoadingDeprecatedFeatureWarning`](#qiskit.qpy.QPYLoadingDeprecatedFeatureWarning "qiskit.qpy.QPYLoadingDeprecatedFeatureWarning") informing of the deprecation period and how the feature will be internally handled. -#### QPYLoadingDeprecatedFeatureWarning +### QPYLoadingDeprecatedFeatureWarning Visible deprecation warning for QPY loading functions without a stable point in the call stack. -#### QPY format version history +### QPY format version history If you’re planning to load a QPY file between different Qiskit versions knowing which versions were available in a given release are useful. As the QPY is backwards compatible but not forwards compatible you need to ensure a given QPY format version was released in the release you’re calling [`load()`](#qiskit.qpy.load "qiskit.qpy.load") with. The following table lists the QPY versions that were supported in every Qiskit (and qiskit-terra prior to Qiskit 1.0.0) release going back to the introduction of QPY in qiskit-terra 0.18.0. @@ -329,7 +329,7 @@ The EXPR\_VAR variable has gained a new type code and payload, in addition to th Notably, this new type-code indexes into pre-defined variables from the circuit header, rather than redefining the variable again in each location it is used. -#### Changes to EXPRESSION +### Changes to EXPRESSION The EXPRESSION type code has a new possible entry, `i`, corresponding to [`expr.Index`](circuit_classical#qiskit.circuit.classical.expr.Index "qiskit.circuit.classical.expr.Index") nodes. diff --git a/docs/api/qiskit/dev/result.mdx b/docs/api/qiskit/dev/result.mdx index 1b7700e277d..0c65b7ac2c5 100644 --- a/docs/api/qiskit/dev/result.mdx +++ b/docs/api/qiskit/dev/result.mdx @@ -18,12 +18,16 @@ python_api_name: qiskit.result `qiskit.result` +## Core classes + | | | | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | [`Result`](qiskit.result.Result "qiskit.result.Result")(backend\_name, backend\_version, ...\[, ...]) | Model for Results. | | [`ResultError`](qiskit.result.ResultError "qiskit.result.ResultError")(error) | Exceptions raised due to errors in result output. | | [`Counts`](qiskit.result.Counts "qiskit.result.Counts")(data\[, time\_taken, creg\_sizes, ...]) | A class to store a counts result from a circuit execution. | +## Marginalization + ### marginal\_counts diff --git a/docs/api/qiskit/dev/scheduler.mdx b/docs/api/qiskit/dev/scheduler.mdx index 116883c93ca..7e91c9d6086 100644 --- a/docs/api/qiskit/dev/scheduler.mdx +++ b/docs/api/qiskit/dev/scheduler.mdx @@ -20,6 +20,8 @@ python_api_name: qiskit.scheduler A circuit scheduler compiles a circuit program to a pulse program. +## Core API + ### ScheduleConfig @@ -64,9 +66,7 @@ A circuit scheduler compiles a circuit program to a pulse program. [*Schedule*](qiskit.pulse.Schedule "qiskit.pulse.schedule.Schedule") - - -Pulse scheduling methods. +## Pulse scheduling methods ### as\_soon\_as\_possible diff --git a/docs/api/qiskit/dev/synthesis.mdx b/docs/api/qiskit/dev/synthesis.mdx index 51312c4ad5f..f644d9ea739 100644 --- a/docs/api/qiskit/dev/synthesis.mdx +++ b/docs/api/qiskit/dev/synthesis.mdx @@ -765,11 +765,7 @@ $$ 1. Shende, Bullock, Markov, *Synthesis of Quantum Logic Circuits*, [arXiv:0406176 \[quant-ph\]](https://arxiv.org/abs/quant-ph/0406176) -The Approximate Quantum Compiler is available here: - -| | | -| --------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | -| [`qiskit.synthesis.unitary.aqc`](qiskit.synthesis.unitary.aqc#module-qiskit.synthesis.unitary.aqc "qiskit.synthesis.unitary.aqc") | Approximate Quantum Compiler (qiskit.synthesis.unitary.aqc) | +The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.unitary.aqc`](qiskit.synthesis.unitary.aqc#module-qiskit.synthesis.unitary.aqc "qiskit.synthesis.unitary.aqc"). ## One-Qubit Synthesis diff --git a/docs/api/qiskit/dev/transpiler_passes.mdx b/docs/api/qiskit/dev/transpiler_passes.mdx index 55f2ca89c5b..6b3d78bee8d 100644 --- a/docs/api/qiskit/dev/transpiler_passes.mdx +++ b/docs/api/qiskit/dev/transpiler_passes.mdx @@ -154,7 +154,9 @@ The synthesis transpiler plugin documentation can be found in the [`qiskit.trans | [`HLSConfig`](qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig")(\[use\_default\_on\_unspecified, ...]) | The high-level-synthesis config allows to specify a list of "methods" used by [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") transformation pass to synthesize different types of higher-level objects. | | [`SolovayKitaev`](qiskit.transpiler.passes.SolovayKitaev "qiskit.transpiler.passes.SolovayKitaev")(\*args, \*\*kwargs) | Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. | -## Post Layout (Post transpile qubit selection) +## Post Layout + +These are post qubit selection. | | | | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/public/api/qiskit/dev/objects.inv b/public/api/qiskit/dev/objects.inv index 657e75c788d..d18b6c15f5c 100644 Binary files a/public/api/qiskit/dev/objects.inv and b/public/api/qiskit/dev/objects.inv differ diff --git a/public/images/api/qiskit/dev/circuit-3.png b/public/images/api/qiskit/dev/circuit-3.png index a97f1e4fe3e..a37f1ea0c66 100644 Binary files a/public/images/api/qiskit/dev/circuit-3.png and b/public/images/api/qiskit/dev/circuit-3.png differ diff --git a/public/images/api/qiskit/dev/providers_fake_provider-1_02.png b/public/images/api/qiskit/dev/providers_fake_provider-1_02.png index 3b99d6f55d7..2f5817003bd 100644 Binary files a/public/images/api/qiskit/dev/providers_fake_provider-1_02.png and b/public/images/api/qiskit/dev/providers_fake_provider-1_02.png differ diff --git a/public/images/api/qiskit/dev/pulse-2.png b/public/images/api/qiskit/dev/pulse-2.png index fda1bb44e9b..885abc65d47 100644 Binary files a/public/images/api/qiskit/dev/pulse-2.png and b/public/images/api/qiskit/dev/pulse-2.png differ diff --git a/public/images/api/qiskit/dev/pulse-3.png b/public/images/api/qiskit/dev/pulse-3.png index d38efa6899f..ba6d52c12f3 100644 Binary files a/public/images/api/qiskit/dev/pulse-3.png and b/public/images/api/qiskit/dev/pulse-3.png differ diff --git a/public/images/api/qiskit/dev/pulse-4.png b/public/images/api/qiskit/dev/pulse-4.png index d8554dd2dd2..5561054dac6 100644 Binary files a/public/images/api/qiskit/dev/pulse-4.png and b/public/images/api/qiskit/dev/pulse-4.png differ diff --git a/public/images/api/qiskit/dev/pulse-5.png b/public/images/api/qiskit/dev/pulse-5.png index 5ee242f4cc9..6c3b8700765 100644 Binary files a/public/images/api/qiskit/dev/pulse-5.png and b/public/images/api/qiskit/dev/pulse-5.png differ diff --git a/public/images/api/qiskit/dev/pulse-6.png b/public/images/api/qiskit/dev/pulse-6.png index 7eba75a338f..ff658931c50 100644 Binary files a/public/images/api/qiskit/dev/pulse-6.png and b/public/images/api/qiskit/dev/pulse-6.png differ diff --git a/public/images/api/qiskit/dev/pulse-7.png b/public/images/api/qiskit/dev/pulse-7.png index 5f3c6fbc20d..34760099931 100644 Binary files a/public/images/api/qiskit/dev/pulse-7.png and b/public/images/api/qiskit/dev/pulse-7.png differ diff --git a/public/images/api/qiskit/dev/qiskit-circuit-ControlledGate-2.png b/public/images/api/qiskit/dev/qiskit-circuit-ControlledGate-2.png index 70bab4e2c93..770bc6cac29 100644 Binary files a/public/images/api/qiskit/dev/qiskit-circuit-ControlledGate-2.png and b/public/images/api/qiskit/dev/qiskit-circuit-ControlledGate-2.png differ diff --git a/public/images/api/qiskit/dev/qiskit-circuit-library-PermutationGate-2.png b/public/images/api/qiskit/dev/qiskit-circuit-library-PermutationGate-2.png index 8d0e756cbfa..f04c91f67eb 100644 Binary files a/public/images/api/qiskit/dev/qiskit-circuit-library-PermutationGate-2.png and b/public/images/api/qiskit/dev/qiskit-circuit-library-PermutationGate-2.png differ diff --git a/public/images/api/qiskit/dev/qiskit-circuit-library-PhaseEstimation-1.png b/public/images/api/qiskit/dev/qiskit-circuit-library-PhaseEstimation-1.png index 0e885e953b9..b8918012c55 100644 Binary files a/public/images/api/qiskit/dev/qiskit-circuit-library-PhaseEstimation-1.png and b/public/images/api/qiskit/dev/qiskit-circuit-library-PhaseEstimation-1.png differ diff --git a/public/images/api/qiskit/dev/qiskit-visualization-plot_circuit_layout-1.png b/public/images/api/qiskit/dev/qiskit-visualization-plot_circuit_layout-1.png index f0b1b58f10f..05058be9c12 100644 Binary files a/public/images/api/qiskit/dev/qiskit-visualization-plot_circuit_layout-1.png and b/public/images/api/qiskit/dev/qiskit-visualization-plot_circuit_layout-1.png differ diff --git a/public/images/api/qiskit/dev/qiskit-visualization-plot_error_map-1.png b/public/images/api/qiskit/dev/qiskit-visualization-plot_error_map-1.png index a87276bdd3e..6e9486887c7 100644 Binary files a/public/images/api/qiskit/dev/qiskit-visualization-plot_error_map-1.png and b/public/images/api/qiskit/dev/qiskit-visualization-plot_error_map-1.png differ diff --git a/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-1.png b/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-1.png index 02237448670..fbb25733f4e 100644 Binary files a/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-1.png and b/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-1.png differ diff --git a/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-2.png b/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-2.png index 55543b29d65..1914d785ead 100644 Binary files a/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-2.png and b/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-2.png differ diff --git a/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-3.png b/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-3.png index 60bea5c5674..710ce71dbc8 100644 Binary files a/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-3.png and b/public/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-3.png differ diff --git a/public/images/api/qiskit/dev/transpiler-16.png b/public/images/api/qiskit/dev/transpiler-16.png index aa89e5c7538..0260bc988b3 100644 Binary files a/public/images/api/qiskit/dev/transpiler-16.png and b/public/images/api/qiskit/dev/transpiler-16.png differ diff --git a/public/images/api/qiskit/dev/transpiler-17.png b/public/images/api/qiskit/dev/transpiler-17.png index 9ff832547f0..ffa444c99bb 100644 Binary files a/public/images/api/qiskit/dev/transpiler-17.png and b/public/images/api/qiskit/dev/transpiler-17.png differ