DeutschJozsa¶
- class DeutschJozsa(oracle, quantum_instance=None)[source]¶
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
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 componentquantum_instance (
Union
[QuantumInstance
,BaseBackend
,None
]) – Quantum Instance or Backend
Attributes
Returns backend.
Returns quantum instance.
Return a numpy random.
Methods
DeutschJozsa.construct_circuit
([measurement])Construct the quantum circuit
DeutschJozsa.run
([quantum_instance])Execute the algorithm with selected backend.
DeutschJozsa.set_backend
(backend, **kwargs)Sets backend with configuration.