BernsteinVazirani
class BernsteinVazirani(oracle, quantum_instance=None)
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 , given a black box oracle function, that maps such that .
Parameters
- oracle (
Oracle
) – The oracle component - quantum_instance (
Union
[QuantumInstance
,BaseBackend
,None
]) – Quantum Instance or Backend
Attributes
backend
quantum_instance
Type: Union[None, qiskit.aqua.quantum_instance.QuantumInstance]
Returns quantum instance.
Return type
Optional
[QuantumInstance
]
random
Return a numpy random.
Methods
construct_circuit
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
run
BernsteinVazirani.run(quantum_instance=None, **kwargs)
Execute the algorithm with selected backend.
Parameters
- quantum_instance (
Union
[QuantumInstance
,BaseBackend
,None
]) – the experimental setting. - kwargs (dict) – kwargs
Returns
results of an algorithm.
Return type
dict
Raises
AquaError – If a quantum instance or backend has not been provided
set_backend
BernsteinVazirani.set_backend(backend, **kwargs)
Sets backend with configuration.
Return type
None