107 lines
3.4 KiB
Plaintext
107 lines
3.4 KiB
Plaintext
---
|
||
title: DeutschJozsa
|
||
description: API reference for qiskit.aqua.algorithms.DeutschJozsa
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.aqua.algorithms.DeutschJozsa
|
||
---
|
||
|
||
# DeutschJozsa
|
||
|
||
<Class id="qiskit.aqua.algorithms.DeutschJozsa" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/aqua/algorithms/education/deutsch_jozsa.py" signature="DeutschJozsa(oracle, quantum_instance=None)" modifiers="class">
|
||
Bases: `qiskit.aqua.algorithms.quantum_algorithm.QuantumAlgorithm`
|
||
|
||
The Deutsch-Jozsa algorithm.
|
||
|
||
The Deutsch-Jozsa algorithm was one of the first known quantum algorithms that showed an exponential speedup compared to a deterministic (non-probabilistic) classical algorithm, given a black box oracle function. The algorithm determines whether the given function $f:\{0,1\}^n \rightarrow \{0,1\}$ is constant or balanced. A constant function maps all inputs to 0 or 1, and a balanced function maps half of its inputs to 0 and the other half to 1.
|
||
|
||
Note: the [`TruthTableOracle`](qiskit.aqua.components.oracles.TruthTableOracle "qiskit.aqua.components.oracles.TruthTableOracle") facilitates creating a constant or balanced function but any oracle can be used as long as the boolean function implemented by the oracle indeed satisfies the constraint of being either constant or balanced.
|
||
|
||
**Parameters**
|
||
|
||
* **oracle** (`Oracle`) – The oracle component
|
||
* **quantum\_instance** (`Union`\[`QuantumInstance`, `Backend`, `BaseBackend`, `None`]) – Quantum Instance or Backend
|
||
|
||
## Methods
|
||
|
||
### construct\_circuit
|
||
|
||
<Function id="qiskit.aqua.algorithms.DeutschJozsa.construct_circuit" signature="DeutschJozsa.construct_circuit(measurement=False)">
|
||
Construct the quantum circuit
|
||
|
||
**Parameters**
|
||
|
||
**measurement** (*bool*) – Boolean flag to indicate if measurement should be included in the circuit.
|
||
|
||
**Returns**
|
||
|
||
the QuantumCircuit object for the constructed circuit
|
||
|
||
**Return type**
|
||
|
||
[QuantumCircuit](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")
|
||
</Function>
|
||
|
||
### run
|
||
|
||
<Function id="qiskit.aqua.algorithms.DeutschJozsa.run" signature="DeutschJozsa.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.DeutschJozsa.set_backend" signature="DeutschJozsa.set_backend(backend, **kwargs)">
|
||
Sets backend with configuration.
|
||
|
||
**Return type**
|
||
|
||
`None`
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### backend
|
||
|
||
<Attribute id="qiskit.aqua.algorithms.DeutschJozsa.backend">
|
||
Returns backend.
|
||
|
||
**Return type**
|
||
|
||
`Union`\[`Backend`, `BaseBackend`]
|
||
</Attribute>
|
||
|
||
### quantum\_instance
|
||
|
||
<Attribute id="qiskit.aqua.algorithms.DeutschJozsa.quantum_instance">
|
||
Returns quantum instance.
|
||
|
||
**Return type**
|
||
|
||
`Optional`\[`QuantumInstance`]
|
||
</Attribute>
|
||
|
||
### random
|
||
|
||
<Attribute id="qiskit.aqua.algorithms.DeutschJozsa.random">
|
||
Return a numpy random.
|
||
</Attribute>
|
||
</Class>
|
||
|