forked from Qiskit/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Qiskit Runtime 0.18 docs (Qiskit#729)
The 0.17 docs are moved to be historical via `npm run make-historical -- -p qiskit-ibm-runtime`. The 0.18 docs were generated with `npm run gen-api -- -p qiskit-ibm-runtime -v 0.18.0 -a https://github.com/Qiskit/qiskit-ibm-runtime/actions/runs/7703740124/artifacts/1204347771`. Note that they include two new top-level modules, closing Qiskit#238. This PR resulted in discovering Qiskit#732. This has always been a problem we didn't know about. I manually ignore the broken links for now to unblock the Runtime 0.18 release and to close Qiskit#238.
- Loading branch information
1 parent
ab5ad12
commit 98c6d8f
Showing
163 changed files
with
30,867 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "qiskit-ibm-runtime", | ||
"version": "0.17.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"title": "Qiskit Runtime IBM Client", | ||
"children": [ | ||
{ | ||
"title": "qiskit_ibm_runtime", | ||
"children": [ | ||
{ | ||
"title": "Overview", | ||
"url": "/api/qiskit-ibm-runtime/0.17/runtime_service" | ||
}, | ||
{ | ||
"title": "Estimator", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.Estimator" | ||
}, | ||
{ | ||
"title": "IBMBackend", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.IBMBackend" | ||
}, | ||
{ | ||
"title": "QiskitRuntimeService", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.QiskitRuntimeService" | ||
}, | ||
{ | ||
"title": "RuntimeDecoder", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.RuntimeDecoder" | ||
}, | ||
{ | ||
"title": "RuntimeEncoder", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.RuntimeEncoder" | ||
}, | ||
{ | ||
"title": "RuntimeJob", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.RuntimeJob" | ||
}, | ||
{ | ||
"title": "RuntimeOptions", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.RuntimeOptions" | ||
}, | ||
{ | ||
"title": "Sampler", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.Sampler" | ||
}, | ||
{ | ||
"title": "Session", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.Session" | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "qiskit_ibm_runtime.options", | ||
"children": [ | ||
{ | ||
"title": "Overview", | ||
"url": "/api/qiskit-ibm-runtime/0.17/options" | ||
}, | ||
{ | ||
"title": "EnvironmentOptions", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.options.EnvironmentOptions" | ||
}, | ||
{ | ||
"title": "ExecutionOptions", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.options.ExecutionOptions" | ||
}, | ||
{ | ||
"title": "Options", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.options.Options" | ||
}, | ||
{ | ||
"title": "ResilienceOptions", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.options.ResilienceOptions" | ||
}, | ||
{ | ||
"title": "SimulatorOptions", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.options.SimulatorOptions" | ||
}, | ||
{ | ||
"title": "TranspilationOptions", | ||
"url": "/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.options.TranspilationOptions" | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "Release notes", | ||
"url": "/api/qiskit-ibm-runtime/release-notes" | ||
} | ||
], | ||
"collapsed": true | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Qiskit Runtime IBM Client API Docs | ||
description: API documentation for qiskit-ibm-runtime | ||
--- | ||
|
||
# qiskit-ibm-runtime API reference | ||
|
||
* [Qiskit Runtime (`qiskit_ibm_runtime`)](runtime_service) | ||
* [Primitive options (`qiskit_ibm_runtime.options`)](options) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: options | ||
description: API reference for qiskit_ibm_runtime.options | ||
in_page_toc_min_heading_level: 1 | ||
python_api_type: module | ||
python_api_name: qiskit_ibm_runtime.options | ||
--- | ||
|
||
<span id="primitive-options-qiskit-ibm-runtime-options" /> | ||
|
||
<span id="module-qiskit_ibm_runtime.options" /> | ||
|
||
# Primitive options | ||
|
||
<span id="module-qiskit_ibm_runtime.options" /> | ||
|
||
`qiskit_ibm_runtime.options` | ||
|
||
Options that can be passed to the primitives. | ||
|
||
The [`Options`](qiskit_ibm_runtime.options.Options "qiskit_ibm_runtime.options.Options") class encapsulates all the options you can specify when invoking a primitive. It includes frequently used options, such as `optimization_level` and `resilience_level` as well as sub-categories, such as `transpilation` and `execution`. You can use auto-complete to easily find the options inside each sub-category, for example: | ||
|
||
```python | ||
from qiskit_ibm_runtime.options import Options | ||
|
||
options = Options() | ||
options.transpilation.initial_layout = [0, 1, 2, 3] # This an be done using auto-complete | ||
``` | ||
|
||
You can also pass dictionaries to each sub-category, for example: | ||
|
||
```python | ||
from qiskit_ibm_runtime.options import Options | ||
|
||
options = Options(transpilation={"initial_layout": [0, 1, 2, 3]}) | ||
``` | ||
|
||
## Classes | ||
|
||
| | | | ||
| -------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | | ||
| [`Options`](qiskit_ibm_runtime.options.Options "qiskit_ibm_runtime.options.Options")(\[optimization\_level, ...]) | Options for the primitives. | | ||
| [`TranspilationOptions`](qiskit_ibm_runtime.options.TranspilationOptions "qiskit_ibm_runtime.options.TranspilationOptions")(\[skip\_transpilation, ...]) | Transpilation options. | | ||
| [`ResilienceOptions`](qiskit_ibm_runtime.options.ResilienceOptions "qiskit_ibm_runtime.options.ResilienceOptions")(\[noise\_amplifier, ...]) | Resilience options. | | ||
| [`ExecutionOptions`](qiskit_ibm_runtime.options.ExecutionOptions "qiskit_ibm_runtime.options.ExecutionOptions")(\[shots, init\_qubits]) | Execution options. | | ||
| [`EnvironmentOptions`](qiskit_ibm_runtime.options.EnvironmentOptions "qiskit_ibm_runtime.options.EnvironmentOptions")(\[log\_level, callback, ...]) | Options related to the execution environment. | | ||
| [`SimulatorOptions`](qiskit_ibm_runtime.options.SimulatorOptions "qiskit_ibm_runtime.options.SimulatorOptions")(\[noise\_model, ...]) | Simulator options. | | ||
|
187 changes: 187 additions & 0 deletions
187
docs/api/qiskit-ibm-runtime/0.17/qiskit_ibm_runtime.Estimator.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
--- | ||
title: Estimator | ||
description: API reference for qiskit_ibm_runtime.Estimator | ||
in_page_toc_min_heading_level: 1 | ||
python_api_type: class | ||
python_api_name: qiskit_ibm_runtime.Estimator | ||
--- | ||
|
||
# Estimator | ||
|
||
<span id="qiskit_ibm_runtime.Estimator" /> | ||
|
||
`Estimator(backend=None, session=None, options=None)`[GitHub](https://github.com/qiskit/qiskit-ibm-runtime/tree/stable/0.17/qiskit_ibm_runtime/estimator.py "view source code") | ||
|
||
Class for interacting with Qiskit Runtime Estimator primitive service. | ||
|
||
Qiskit Runtime Estimator primitive service estimates expectation values of quantum circuits and observables. | ||
|
||
The [`run()`](#qiskit_ibm_runtime.Estimator.run "qiskit_ibm_runtime.Estimator.run") can be used to submit circuits, observables, and parameters to the Estimator primitive. | ||
|
||
You are encouraged to use [`Session`](qiskit_ibm_runtime.Session "qiskit_ibm_runtime.Session") to open a session, during which you can invoke one or more primitives. Jobs submitted within a session are prioritized by the scheduler, and data is cached for efficiency. | ||
|
||
Example: | ||
|
||
```python | ||
from qiskit.circuit.library import RealAmplitudes | ||
from qiskit.quantum_info import SparsePauliOp | ||
|
||
from qiskit_ibm_runtime import QiskitRuntimeService, Estimator | ||
|
||
service = QiskitRuntimeService(channel="ibm_cloud") | ||
|
||
psi1 = RealAmplitudes(num_qubits=2, reps=2) | ||
|
||
H1 = SparsePauliOp.from_list([("II", 1), ("IZ", 2), ("XI", 3)]) | ||
H2 = SparsePauliOp.from_list([("IZ", 1)]) | ||
H3 = SparsePauliOp.from_list([("ZI", 1), ("ZZ", 1)]) | ||
|
||
with Session(service=service, backend="ibmq_qasm_simulator") as session: | ||
estimator = Estimator(session=session) | ||
|
||
theta1 = [0, 1, 1, 2, 3, 5] | ||
|
||
# calculate [ <psi1(theta1)|H1|psi1(theta1)> ] | ||
psi1_H1 = estimator.run(circuits=[psi1], observables=[H1], parameter_values=[theta1]) | ||
print(psi1_H1.result()) | ||
|
||
# calculate [ <psi1(theta1)|H2|psi1(theta1)>, <psi1(theta1)|H3|psi1(theta1)> ] | ||
psi1_H23 = estimator.run( | ||
circuits=[psi1, psi1], | ||
observables=[H2, H3], | ||
parameter_values=[theta1]*2 | ||
) | ||
print(psi1_H23.result()) | ||
``` | ||
|
||
Initializes the Estimator primitive. | ||
|
||
**Parameters** | ||
|
||
* **backend** (`Union`\[`str`, [`IBMBackend`](qiskit_ibm_runtime.IBMBackend "qiskit_ibm_runtime.ibm_backend.IBMBackend"), `None`]) – Backend to run the primitive. This can be a backend name or an [`IBMBackend`](qiskit_ibm_runtime.IBMBackend "qiskit_ibm_runtime.IBMBackend") instance. If a name is specified, the default account (e.g. `QiskitRuntimeService()`) is used. | ||
|
||
* **session** (`Union`\[[`Session`](qiskit_ibm_runtime.Session "qiskit_ibm_runtime.session.Session"), `str`, [`IBMBackend`](qiskit_ibm_runtime.IBMBackend "qiskit_ibm_runtime.ibm_backend.IBMBackend"), `None`]) – | ||
|
||
Session in which to call the primitive. | ||
|
||
If both `session` and `backend` are specified, `session` takes precedence. If neither is specified, and the primitive is created inside a [`qiskit_ibm_runtime.Session`](qiskit_ibm_runtime.Session "qiskit_ibm_runtime.Session") context manager, then the session is used. Otherwise if IBM Cloud channel is used, a default backend is selected. | ||
|
||
* **options** (`Union`\[`Dict`, [`Options`](qiskit_ibm_runtime.options.Options "qiskit_ibm_runtime.options.options.Options"), `None`]) – Primitive options, see `Options` for detailed description. The `backend` keyword is still supported but is deprecated. | ||
|
||
## Attributes | ||
|
||
<span id="qiskit_ibm_runtime.Estimator.circuits" /> | ||
|
||
### circuits | ||
|
||
Quantum circuits that represents quantum states. | ||
|
||
**Return type** | ||
|
||
`tuple`\[`QuantumCircuit`, `...`] | ||
|
||
**Returns** | ||
|
||
The quantum circuits. | ||
|
||
<span id="qiskit_ibm_runtime.Estimator.observables" /> | ||
|
||
### observables | ||
|
||
Observables to be estimated. | ||
|
||
**Return type** | ||
|
||
`tuple`\[`SparsePauliOp`, `...`] | ||
|
||
**Returns** | ||
|
||
The observables. | ||
|
||
<span id="qiskit_ibm_runtime.Estimator.options" /> | ||
|
||
### options | ||
|
||
Return options values for the sampler. | ||
|
||
**Return type** | ||
|
||
`Options` | ||
|
||
**Returns** | ||
|
||
options | ||
|
||
<span id="qiskit_ibm_runtime.Estimator.parameters" /> | ||
|
||
### parameters | ||
|
||
Parameters of the quantum circuits. | ||
|
||
**Return type** | ||
|
||
`tuple`\[`ParameterView`, `...`] | ||
|
||
**Returns** | ||
|
||
Parameters, where `parameters[i][j]` is the j-th parameter of the i-th circuit. | ||
|
||
<span id="qiskit_ibm_runtime.Estimator.session" /> | ||
|
||
### session | ||
|
||
Return session used by this primitive. | ||
|
||
**Return type** | ||
|
||
`Optional`\[[`Session`](qiskit_ibm_runtime.Session "qiskit_ibm_runtime.session.Session")] | ||
|
||
**Returns** | ||
|
||
Session used by this primitive, or `None` if session is not used. | ||
|
||
## Methods | ||
|
||
### run | ||
|
||
<span id="qiskit_ibm_runtime.Estimator.run" /> | ||
|
||
`run(circuits, observables, parameter_values=None, **kwargs)` | ||
|
||
Submit a request to the estimator primitive. | ||
|
||
**Parameters** | ||
|
||
* **circuits** (*QuantumCircuit | Sequence\[QuantumCircuit]*) – a (parameterized) `QuantumCircuit` or a list of (parameterized) `QuantumCircuit`. | ||
* **observables** (*BaseOperator | PauliSumOp | Sequence\[BaseOperator | PauliSumOp]*) – Observable objects. | ||
* **parameter\_values** (*Sequence\[float] | Sequence\[Sequence\[float]] | None*) – Concrete parameters to be bound. | ||
* **\*\*kwargs** – Individual options to overwrite the default primitive options. These include the runtime options in [`qiskit_ibm_runtime.RuntimeOptions`](qiskit_ibm_runtime.RuntimeOptions "qiskit_ibm_runtime.RuntimeOptions"). | ||
|
||
**Return type** | ||
|
||
[RuntimeJob](qiskit_ibm_runtime.RuntimeJob "qiskit_ibm_runtime.RuntimeJob") | ||
|
||
**Returns** | ||
|
||
Submitted job. The result of the job is an instance of `qiskit.primitives.EstimatorResult`. | ||
|
||
**Raises** | ||
|
||
**ValueError** – Invalid arguments are given. | ||
|
||
### set\_options | ||
|
||
<span id="qiskit_ibm_runtime.Estimator.set_options" /> | ||
|
||
`set_options(**fields)` | ||
|
||
Set options values for the sampler. | ||
|
||
**Parameters** | ||
|
||
**\*\*fields** – The fields to update the options | ||
|
||
**Return type** | ||
|
||
`None` | ||
|
Oops, something went wrong.