Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.
Important

IBM Quantum Platform is moving and this version will be sunset on July 1. To get started on the new platform, read the migration guide.

CustomCircuitOracle

class CustomCircuitOracle(variable_register=None, output_register=None, ancillary_register=None, circuit=None, evaluate_classically_callback=None)

GitHub

The Custom Circuit-based Quantum Oracle.

A helper class to, in essence, ‘wrap’ a user-supplied quantum circuit such that it becomes of type Oracle and hence can be used by algorithms taking an oracle as input.

This class is provided for easy creation of oracles using custom circuits. It is geared towards programmatically experimenting with oracles, where a user directly provides a QuantumCircuit object, corresponding to the intended oracle function, together with the various QuantumRegister objects involved.

Parameters

  • variable_register (Optional[QuantumRegister]) – The register holding variable qubit(s) for the oracle function
  • output_register (Optional[QuantumRegister]) – The register holding output qubit(s) for the oracle function
  • ancillary_register (Optional[QuantumRegister]) – The register holding ancillary qubit(s)
  • circuit (Optional[QuantumCircuit]) – The quantum circuit corresponding to the intended oracle function
  • evaluate_classically_callback (Optional[Callable[[str], Tuple[bool, List[int]]]]) – The classical callback function for evaluating the oracle, for example, to use with Grover’s search

Raises

AquaError – Invalid input


Attributes

ancillary_register

returns ancillary register

circuit

output_register

returns output register

variable_register

returns variable register


Methods

construct_circuit

CustomCircuitOracle.construct_circuit()

Construct the oracle circuit.

Returns

A quantum circuit for the oracle.

Return type

QuantumCircuit

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