111 lines
3.2 KiB
Plaintext
111 lines
3.2 KiB
Plaintext
---
|
||
title: BernsteinVazirani (v0.29)
|
||
description: API reference for qiskit.aqua.algorithms.BernsteinVazirani in qiskit v0.29
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.aqua.algorithms.BernsteinVazirani
|
||
---
|
||
|
||
# BernsteinVazirani
|
||
|
||
<Class id="qiskit.aqua.algorithms.BernsteinVazirani" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/aqua/algorithms/education/bernstein_vazirani.py" signature="BernsteinVazirani(oracle, quantum_instance=None)" modifiers="class">
|
||
Bases: `qiskit.aqua.algorithms.quantum_algorithm.QuantumAlgorithm`
|
||
|
||
The Bernstein-Vazirani algorithm.
|
||
|
||
The Bernstein-Vazirani algorithm is an extension / restriction of the Deutsch-Jozsa algorithm. The goal of the algorithm is to determine a secret string $s \in \{0,1\}^n$, given a black box oracle function, that maps $f:\{0,1\}^n \rightarrow \{0,1\}$ such that $f(x)=s \cdot x (\bmod 2)$.
|
||
|
||
**Parameters**
|
||
|
||
* **oracle** (`Oracle`) – The oracle component
|
||
* **quantum\_instance** (`Union`\[`QuantumInstance`, `Backend`, `BaseBackend`, `None`]) – Quantum Instance or Backend
|
||
|
||
## Methods
|
||
|
||
<span id="qiskit-aqua-algorithms-bernsteinvazirani-construct-circuit" />
|
||
|
||
### construct\_circuit
|
||
|
||
<Function id="qiskit.aqua.algorithms.BernsteinVazirani.construct_circuit" signature="BernsteinVazirani.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>
|
||
|
||
<span id="qiskit-aqua-algorithms-bernsteinvazirani-run" />
|
||
|
||
### run
|
||
|
||
<Function id="qiskit.aqua.algorithms.BernsteinVazirani.run" signature="BernsteinVazirani.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-bernsteinvazirani-set-backend" />
|
||
|
||
### set\_backend
|
||
|
||
<Function id="qiskit.aqua.algorithms.BernsteinVazirani.set_backend" signature="BernsteinVazirani.set_backend(backend, **kwargs)">
|
||
Sets backend with configuration.
|
||
|
||
**Return type**
|
||
|
||
`None`
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### backend
|
||
|
||
<Attribute id="qiskit.aqua.algorithms.BernsteinVazirani.backend">
|
||
Returns backend.
|
||
|
||
**Return type**
|
||
|
||
`Union`\[`Backend`, `BaseBackend`]
|
||
</Attribute>
|
||
|
||
### quantum\_instance
|
||
|
||
<Attribute id="qiskit.aqua.algorithms.BernsteinVazirani.quantum_instance">
|
||
Returns quantum instance.
|
||
|
||
**Return type**
|
||
|
||
`Optional`\[`QuantumInstance`]
|
||
</Attribute>
|
||
|
||
### random
|
||
|
||
<Attribute id="qiskit.aqua.algorithms.BernsteinVazirani.random">
|
||
Return a numpy random.
|
||
</Attribute>
|
||
</Class>
|
||
|