qiskit.algorithms.AmplificationProblem(oracle, state_preparation=None, grover_operator=None, post_processing=None, objective_qubits=None, is_good_state=None)
object (opens in a new tab)
The amplification problem is the input to amplitude amplification algorithms, like Grover.
This class contains all problem-specific information required to run an amplitude amplification algorithm. It minimally contains the Grover operator. It can further hold some post processing on the optimal bitstring.
- oracle (QuantumCircuit |Statevector) – The oracle reflecting about the bad states.
- state_preparation (QuantumCircuit | None) – A circuit preparing the input state, referred to as . If None, a layer of Hadamard gates is used.
- grover_operator (QuantumCircuit | None) – The Grover operator used as unitary in the phase estimation circuit. If None, this operator is constructed from the
- post_processing (Callable[[str (opens in a new tab)], Any] | None) – A mapping applied to the most likely bitstring.
- objective_qubits (int (opens in a new tab) |list (opens in a new tab)[int (opens in a new tab)] | None) – If set, specifies the indices of the qubits that should be measured. If None, all qubits will be measured. The
is_good_statefunction will be applied on the measurement outcome of these qubits.
- is_good_state (Callable[[str (opens in a new tab)], bool (opens in a new tab)] | list (opens in a new tab)[int (opens in a new tab)] | list (opens in a new tab)[str (opens in a new tab)] | Statevector | None) – A function to check whether a string represents a good state. By default if the
oracleargument has an
evaluate_bitstringmethod (currently only provided by the
PhaseOracleclass) this will be used, otherwise this kwarg is required and must be specified.
Get the operator, or Grover operator.
If the Grover operator is not set, we try to build it from the operator and objective_qubits. This only works if objective_qubits is a list of integers.
The Grover operator, or None if neither the Grover operator nor the operator is set.
Check whether a provided bitstring is a good state or not.
A callable that takes in a bitstring and returns True if the measurement is a good state, False otherwise.
The indices of the objective qubits.
The indices of the objective qubits as list of integers.
Return the oracle.
Apply post processing to the input value.
A handle to the post processing function. Acts as identity by default.
Get the state preparation operator .
The operator as QuantumCircuit.