qiskit.algorithms.AmplificationProblem¶

class
AmplificationProblem
(oracle, state_preparation=None, grover_operator=None, post_processing=None, objective_qubits=None, is_good_state=None)[소스]¶ The amplification problem is the input to amplitude amplification algorithms, like Grover.
This class contains all problemspecific 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 (
Union
[QuantumCircuit
,Statevector
]) – The oracle reflecting about the bad states.state_preparation (
Optional
[QuantumCircuit
]) – A circuit preparing the input state, referred to as \(\mathcal{A}\). If None, a layer of Hadamard gates is used.grover_operator (
Optional
[QuantumCircuit
]) – The Grover operator \(\mathcal{Q}\) used as unitary in the phase estimation circuit. If None, this operator is constructed from theoracle
andstate_preparation
.post_processing (
Optional
[Callable
[[str
],Any
]]) – A mapping applied to the most likely bitstring.objective_qubits (
Union
[int
,List
[int
],None
]) – If set, specifies the indices of the qubits that should be measured. If None, all qubits will be measured. Theis_good_state
function will be applied on the measurement outcome of these qubits.is_good_state (
Union
[Callable
[[str
],bool
],List
[int
],List
[str
],Statevector
,None
]) – A function to check whether a string represents a good state. By default if theoracle
argument has anevaluate_bitstring
method (currently only provided by thePhaseOracle
class) this will be used, otherwise this kwarg is required and must be specified.
 예외
TypeError – if
is_good_state
is not provided and is required

__init__
(oracle, state_preparation=None, grover_operator=None, post_processing=None, objective_qubits=None, is_good_state=None)[소스]¶  매개변수
oracle (
Union
[QuantumCircuit
,Statevector
]) – The oracle reflecting about the bad states.state_preparation (
Optional
[QuantumCircuit
]) – A circuit preparing the input state, referred to as \(\mathcal{A}\). If None, a layer of Hadamard gates is used.grover_operator (
Optional
[QuantumCircuit
]) – The Grover operator \(\mathcal{Q}\) used as unitary in the phase estimation circuit. If None, this operator is constructed from theoracle
andstate_preparation
.post_processing (
Optional
[Callable
[[str
],Any
]]) – A mapping applied to the most likely bitstring.objective_qubits (
Union
[int
,List
[int
],None
]) – If set, specifies the indices of the qubits that should be measured. If None, all qubits will be measured. Theis_good_state
function will be applied on the measurement outcome of these qubits.is_good_state (
Union
[Callable
[[str
],bool
],List
[int
],List
[str
],Statevector
,None
]) – A function to check whether a string represents a good state. By default if theoracle
argument has anevaluate_bitstring
method (currently only provided by thePhaseOracle
class) this will be used, otherwise this kwarg is required and must be specified.
 예외
TypeError – if
is_good_state
is not provided and is required
Methods
__init__
(oracle[, state_preparation, …]) type oracle
Union
[QuantumCircuit
,Statevector
]
Attributes
Get the \(\mathcal{Q}\) operator, or Grover operator.
Check whether a provided bitstring is a good state or not.
The indices of the objective qubits.
Return the oracle.
Apply post processing to the input value.
Get the state preparation operator \(\mathcal{A}\).

property
grover_operator
¶ Get the \(\mathcal{Q}\) operator, or Grover operator.
If the Grover operator is not set, we try to build it from the \(\mathcal{A}\) operator and objective_qubits. This only works if objective_qubits is a list of integers.
 반환 형식
Optional
[QuantumCircuit
] 반환값
The Grover operator, or None if neither the Grover operator nor the \(\mathcal{A}\) operator is set.

property
is_good_state
¶ Check whether a provided bitstring is a good state or not.
 반환 형식
Callable
[[str
],bool
] 반환값
A callable that takes in a bitstring and returns True if the measurement is a good state, False otherwise.

property
objective_qubits
¶ The indices of the objective qubits.
 반환 형식
List
[int
] 반환값
The indices of the objective qubits as list of integers.

property
oracle
¶ Return the oracle.
 반환 형식
Union
[QuantumCircuit
,Statevector
] 반환값
The oracle.

property
post_processing
¶ Apply post processing to the input value.
 반환 형식
Callable
[[str
],Any
] 반환값
A handle to the post processing function. Acts as identity by default.

property
state_preparation
¶ Get the state preparation operator \(\mathcal{A}\).
 반환 형식
QuantumCircuit
 반환값
The \(\mathcal{A}\) operator as QuantumCircuit.