100 lines
4.1 KiB
Plaintext
100 lines
4.1 KiB
Plaintext
---
|
||
title: QuantumAlgorithm (v0.26)
|
||
description: API reference for qiskit.aqua.algorithms.QuantumAlgorithm in qiskit v0.26
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.aqua.algorithms.QuantumAlgorithm
|
||
---
|
||
|
||
<span id="qiskit-aqua-algorithms-quantumalgorithm" />
|
||
|
||
# qiskit.aqua.algorithms.QuantumAlgorithm
|
||
|
||
<Class id="qiskit.aqua.algorithms.QuantumAlgorithm" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/aqua/algorithms/quantum_algorithm.py" signature="QuantumAlgorithm(quantum_instance)" modifiers="class">
|
||
Base class for Quantum Algorithms.
|
||
|
||
This method should initialize the module and use an exception if a component of the module is available.
|
||
|
||
### \_\_init\_\_
|
||
|
||
<Function id="qiskit.aqua.algorithms.QuantumAlgorithm.__init__" signature="__init__(quantum_instance)" modifiers="abstract">
|
||
Initialize self. See help(type(self)) for accurate signature.
|
||
</Function>
|
||
|
||
## Methods
|
||
|
||
| | |
|
||
| ------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------- |
|
||
| [`__init__`](#qiskit.aqua.algorithms.QuantumAlgorithm.__init__ "qiskit.aqua.algorithms.QuantumAlgorithm.__init__")(quantum\_instance) | Initialize self. |
|
||
| [`run`](#qiskit.aqua.algorithms.QuantumAlgorithm.run "qiskit.aqua.algorithms.QuantumAlgorithm.run")(\[quantum\_instance]) | Execute the algorithm with selected backend. |
|
||
| [`set_backend`](#qiskit.aqua.algorithms.QuantumAlgorithm.set_backend "qiskit.aqua.algorithms.QuantumAlgorithm.set_backend")(backend, \*\*kwargs) | Sets backend with configuration. |
|
||
|
||
## Attributes
|
||
|
||
| | |
|
||
| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------- |
|
||
| [`backend`](#qiskit.aqua.algorithms.QuantumAlgorithm.backend "qiskit.aqua.algorithms.QuantumAlgorithm.backend") | Returns backend. |
|
||
| [`quantum_instance`](#qiskit.aqua.algorithms.QuantumAlgorithm.quantum_instance "qiskit.aqua.algorithms.QuantumAlgorithm.quantum_instance") | Returns quantum instance. |
|
||
| [`random`](#qiskit.aqua.algorithms.QuantumAlgorithm.random "qiskit.aqua.algorithms.QuantumAlgorithm.random") | Return a numpy random. |
|
||
|
||
### backend
|
||
|
||
<Attribute id="qiskit.aqua.algorithms.QuantumAlgorithm.backend">
|
||
Returns backend.
|
||
|
||
**Return type**
|
||
|
||
`Union`\[`Backend`, `BaseBackend`]
|
||
</Attribute>
|
||
|
||
### quantum\_instance
|
||
|
||
<Attribute id="qiskit.aqua.algorithms.QuantumAlgorithm.quantum_instance">
|
||
Returns quantum instance.
|
||
|
||
**Return type**
|
||
|
||
`Optional`\[`QuantumInstance`]
|
||
</Attribute>
|
||
|
||
### random
|
||
|
||
<Attribute id="qiskit.aqua.algorithms.QuantumAlgorithm.random">
|
||
Return a numpy random.
|
||
</Attribute>
|
||
|
||
### run
|
||
|
||
<Function id="qiskit.aqua.algorithms.QuantumAlgorithm.run" signature="run(quantum_instance=None, **kwargs)">
|
||
Execute the algorithm with selected backend.
|
||
|
||
**Parameters**
|
||
|
||
* **quantum\_instance** (`Union`\[`QuantumInstance`, `Backend`, `BaseBackend`, `None`]) – the experimental setting.
|
||
* **kwargs** (*dict*) – kwargs
|
||
|
||
**Returns**
|
||
|
||
results of an algorithm.
|
||
|
||
**Return type**
|
||
|
||
dict
|
||
|
||
**Raises**
|
||
|
||
[**AquaError**](qiskit.aqua.AquaError "qiskit.aqua.AquaError") – If a quantum instance or backend has not been provided
|
||
</Function>
|
||
|
||
### set\_backend
|
||
|
||
<Function id="qiskit.aqua.algorithms.QuantumAlgorithm.set_backend" signature="set_backend(backend, **kwargs)">
|
||
Sets backend with configuration.
|
||
|
||
**Return type**
|
||
|
||
`None`
|
||
</Function>
|
||
</Class>
|
||
|