Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

DeutschJozsa

DeutschJozsa(oracle, quantum_instance=None)

GitHub(opens in a new tab)

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{0,1}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


Attributes

backend

qiskit.providers.basebackend.BaseBackend

Returns backend.

Return type

BaseBackend

quantum_instance

Union[None, qiskit.aqua.quantum_instance.QuantumInstance]

Returns quantum instance.

Return type

Optional[QuantumInstance]

random

Return a numpy random.


Methods

construct_circuit

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

run

DeutschJozsa.run(quantum_instance=None, **kwargs)

Execute the algorithm with selected backend.

Parameters

Returns

results of an algorithm.

Return type

dict

Raises

AquaError – If a quantum instance or backend has not been provided

set_backend

DeutschJozsa.set_backend(backend, **kwargs)

Sets backend with configuration.

Return type

None

Was this page helpful?
Report a bug or request content on GitHub.