qiskit-documentation/docs/api/qiskit/0.31/qiskit.aqua.algorithms.Quan...

86 lines
2.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: QuantumAlgorithm (v0.31)
description: API reference for qiskit.aqua.algorithms.QuantumAlgorithm in qiskit v0.31
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.aqua.algorithms.QuantumAlgorithm
---
# 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">
Bases: `abc.ABC`
Base class for Quantum Algorithms.
This method should initialize the module and use an exception if a component of the module is available.
## Methods
<span id="qiskit-aqua-algorithms-quantumalgorithm-run" />
### run
<Function id="qiskit.aqua.algorithms.QuantumAlgorithm.run" signature="QuantumAlgorithm.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>
<span id="qiskit-aqua-algorithms-quantumalgorithm-set-backend" />
### set\_backend
<Function id="qiskit.aqua.algorithms.QuantumAlgorithm.set_backend" signature="QuantumAlgorithm.set_backend(backend, **kwargs)">
Sets backend with configuration.
**Return type**
`None`
</Function>
## Attributes
### 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>
</Class>