qiskit.aqua.algorithms.IterativeAmplitudeEstimation¶

class
IterativeAmplitudeEstimation
(epsilon, alpha, confint_method='beta', min_ratio=2, state_preparation=None, grover_operator=None, objective_qubits=None, post_processing=None, a_factory=None, q_factory=None, i_objective=None, initial_state=None, quantum_instance=None)[소스]¶ The Iterative Amplitude Estimation algorithm.
This class implements the Iterative Quantum Amplitude Estimation (IQAE) algorithm, proposed in [1]. The output of the algorithm is an estimate that, with at least probability \(1  \alpha\), differs by epsilon to the target value, where both alpha and epsilon can be specified.
It differs from the original QAE algorithm proposed by Brassard [2] in that it does not rely on Quantum Phase Estimation, but is only based on Grover’s algorithm. IQAE iteratively applies carefully selected Grover iterations to find an estimate for the target amplitude.
참조
 [1]: Grinko, D., Gacon, J., Zoufal, C., & Woerner, S. (2019).
Iterative Quantum Amplitude Estimation. arXiv:1912.05559.
 [2]: Brassard, G., Hoyer, P., Mosca, M., & Tapp, A. (2000).
Quantum Amplitude Amplification and Estimation. arXiv:quantph/0005055.
The output of the algorithm is an estimate for the amplitude a, that with at least probability 1  alpha has an error of epsilon. The number of A operator calls scales linearly in 1/epsilon (up to a logarithmic factor).
 매개변수
epsilon (
float
) – Target precision for estimation target a, has values between 0 and 0.5alpha (
float
) – Confidence level, the target probability is 1  alpha, has values between 0 and 1confint_method (
str
) – Statistical method used to estimate the confidence intervals in each iteration, can be 〈chernoff〉 for the Chernoff intervals or 〈beta〉 for the ClopperPearson intervals (default)min_ratio (
float
) – Minimal qratio (\(K_{i+1} / K_i\)) for FindNextKstate_preparation (
Union
[QuantumCircuit
,CircuitFactory
,None
]) – A circuit preparing the input state, referred to as \(\mathcal{A}\).grover_operator (
Union
[QuantumCircuit
,CircuitFactory
,None
]) – The Grover operator \(\mathcal{Q}\) used as unitary in the phase estimation circuit.objective_qubits (
Optional
[List
[int
]]) – A list of qubit indices. A measurement outcome is classified as 〈good〉 state if all objective qubits are in state \(1\rangle\), otherwise it is classified as 〈bad〉.post_processing (
Optional
[Callable
[[float
],float
]]) – A mapping applied to the estimate of \(0 \leq a \leq 1\), usually used to map the estimate to a target interval.a_factory (
Optional
[CircuitFactory
]) – The A operator, specifying the QAE problemq_factory (
Optional
[CircuitFactory
]) – The Q operator (Grover operator), constructed from the A operatori_objective (
Optional
[int
]) – Index of the objective qubit, that marks the 〈good/bad〉 statesinitial_state (
Optional
[QuantumCircuit
]) – A state to prepend to the constructed circuits.quantum_instance (
Union
[QuantumInstance
,Backend
,BaseBackend
,None
]) – Quantum Instance or Backend
 예외
AquaError – if the method to compute the confidence intervals is not supported

__init__
(epsilon, alpha, confint_method='beta', min_ratio=2, state_preparation=None, grover_operator=None, objective_qubits=None, post_processing=None, a_factory=None, q_factory=None, i_objective=None, initial_state=None, quantum_instance=None)[소스]¶ The output of the algorithm is an estimate for the amplitude a, that with at least probability 1  alpha has an error of epsilon. The number of A operator calls scales linearly in 1/epsilon (up to a logarithmic factor).
 매개변수
epsilon (
float
) – Target precision for estimation target a, has values between 0 and 0.5alpha (
float
) – Confidence level, the target probability is 1  alpha, has values between 0 and 1confint_method (
str
) – Statistical method used to estimate the confidence intervals in each iteration, can be 〈chernoff〉 for the Chernoff intervals or 〈beta〉 for the ClopperPearson intervals (default)min_ratio (
float
) – Minimal qratio (\(K_{i+1} / K_i\)) for FindNextKstate_preparation (
Union
[QuantumCircuit
,CircuitFactory
,None
]) – A circuit preparing the input state, referred to as \(\mathcal{A}\).grover_operator (
Union
[QuantumCircuit
,CircuitFactory
,None
]) – The Grover operator \(\mathcal{Q}\) used as unitary in the phase estimation circuit.objective_qubits (
Optional
[List
[int
]]) – A list of qubit indices. A measurement outcome is classified as 〈good〉 state if all objective qubits are in state \(1\rangle\), otherwise it is classified as 〈bad〉.post_processing (
Optional
[Callable
[[float
],float
]]) – A mapping applied to the estimate of \(0 \leq a \leq 1\), usually used to map the estimate to a target interval.a_factory (
Optional
[CircuitFactory
]) – The A operator, specifying the QAE problemq_factory (
Optional
[CircuitFactory
]) – The Q operator (Grover operator), constructed from the A operatori_objective (
Optional
[int
]) – Index of the objective qubit, that marks the 〈good/bad〉 statesinitial_state (
Optional
[QuantumCircuit
]) – A state to prepend to the constructed circuits.quantum_instance (
Union
[QuantumInstance
,Backend
,BaseBackend
,None
]) – Quantum Instance or Backend
 예외
AquaError – if the method to compute the confidence intervals is not supported
Methods
__init__
(epsilon, alpha[, confint_method, …])The output of the algorithm is an estimate for the amplitude a, that with at least probability 1  alpha has an error of epsilon.
construct_circuit
(k[, measurement])Construct the circuit Q^k A 0>.
is_good_state
(measurement)Determine whether a given state is a good state.
post_processing
(value)Post processing of the raw amplitude estimation output \(0 \leq a \leq 1\).
run
([quantum_instance])Execute the algorithm with selected backend.
set_backend
(backend, **kwargs)Sets backend with configuration.
Attributes
Get the A operator encoding the amplitude a that’s approximated, i.e.
Returns backend.
Get the \(\mathcal{Q}\) operator, or Grover operator.
Get the index of the objective qubit.
Get the criterion for a measurement outcome to be in a 〈good〉 state.
Returns the target precision epsilon of the algorithm.
Get the Q operator, or Groveroperator for the Amplitude Estimation algorithm, i.e.
Returns quantum instance.
Return a numpy random.
Get the \(\mathcal{A}\) operator encoding the amplitude \(a\).

property
a_factory
¶ Get the A operator encoding the amplitude a that’s approximated, i.e.
A 0>_n 0> = sqrt{1  a} psi_0>_n 0> + sqrt{a} psi_1>_n 1>
see the original Brassard paper (https://arxiv.org/abs/quantph/0005055) for more detail.
 반환값
the A operator as CircuitFactory
 반환 형식

property
backend
¶ Returns backend.
 반환 형식
Union
[Backend
,BaseBackend
]

construct_circuit
(k, measurement=False)[소스]¶ Construct the circuit Q^k A 0>.
The A operator is the unitary specifying the QAE problem and Q the associated Grover operator.
 매개변수
k (
int
) – The power of the Q operator.measurement (
bool
) – Boolean flag to indicate if measurements should be included in the circuits.
 반환 형식
QuantumCircuit
 반환값
The circuit Q^k A 0>.

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
i_objective
¶ Get the index of the objective qubit. The objective qubit marks the psi_0> state (called 〈bad states〉 in https://arxiv.org/abs/quantph/0005055) with 0> and psi_1> (〈good〉 states) with 1>. If the A operator performs the mapping
A 0>_n 0> = sqrt{1  a} psi_0>_n 0> + sqrt{a} psi_1>_n 1>
then, the objective qubit is the last one (which is either 0> or 1>).
If the objective qubit (i_objective) is not set, we check if the Q operator (q_factory) is set and return the index specified there. If the q_factory is not defined, the index equals the number of qubits of the A operator (a_factory) minus one. If also the a_factory is not set, return None.
 반환값
the index of the objective qubit
 반환 형식
int

is_good_state
(measurement)¶ Determine whether a given state is a good state.
 매개변수
measurement (
str
) – A measurement as bitstring, e.g. 〈01100〉. 반환 형식
bool
 반환값
True if the measurement corresponds to a good state, False otherwise.
 예외
ValueError – If
self.objective_qubits
is not set.

property
objective_qubits
¶ Get the criterion for a measurement outcome to be in a 〈good〉 state.
 반환 형식
Optional
[List
[int
]] 반환값
The criterion as list of qubit indices.

post_processing
(value)¶ Post processing of the raw amplitude estimation output \(0 \leq a \leq 1\).
 매개변수
value (
float
) – The estimation value \(a\). 반환 형식
float
 반환값
The value after post processing, usually mapping the interval \([0, 1]\) to the target interval.

property
precision
¶ Returns the target precision epsilon of the algorithm.
 반환 형식
float
 반환값
The target precision (which is half the width of the confidence interval).

property
q_factory
¶ Get the Q operator, or Groveroperator for the Amplitude Estimation algorithm, i.e.
\[\mathcal{Q} = \mathcal{A} \mathcal{S}_0 \mathcal{A}^\dagger \mathcal{S}_f,\]where \(\mathcal{S}_0\) reflects about the 0>_n state and S_psi0 reflects about \(\Psi_0\rangle_n\). See https://arxiv.org/abs/quantph/0005055 for more detail.
If the Q operator is not set, we try to build it from the A operator. If neither the A operator is set, None is returned.
 반환값
returns the current Q factory of the algorithm
 반환 형식
QFactory

property
quantum_instance
¶ Returns quantum instance.
 반환 형식
Optional
[QuantumInstance
]

property
random
¶ Return a numpy random.

run
(quantum_instance=None, **kwargs)¶ Execute the algorithm with selected backend.
 매개변수
quantum_instance (
Union
[QuantumInstance
,Backend
,BaseBackend
,None
]) – the experimental setting.kwargs (dict) – kwargs
 반환값
results of an algorithm.
 반환 형식
dict
 예외
AquaError – If a quantum instance or backend has not been provided

set_backend
(backend, **kwargs)¶ Sets backend with configuration.
 반환 형식
None

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