bounds
Calculate the asymptotic bound for QFI for adaptive strategies for correlated models [27, 45].
This function returns an upper bound for scaling coefficient and the scaling power (1 for standard scaling, 2 for Heisenberg). Unlike for uncorrelated models, this is just upper bound, not the exact value. The bound becomes tighter for larger
block_size.- Parameters:
channel (ParamChannel) – Object representing an elementary channel or comb and its derivative.
block_size (int) – The number of channels merged in one sub-chain during the algorithm. The larger it is, the tighter the bounds, but also computations are slower and more memory-consuming. It is denoted by
min [27, 45].power (int | None optional) – Power in the QFI scaling law. It can be 1 (standard scaling) or 2 (Heisenberg scaling). When not provided, the scaling type is determined by the algorithm.
- Returns:
coef (float) – Coefficient in the QFI asymptotic bound.
power (int) – Power in the QFI asymptotic bound. Can be 1 or 2.
- Return type:
tuple[float, int]
Notes
The QFI for asymptotically large number of channels \(n\) is upper bounded by \(\mathrm{coef} \cdot n^{\mathrm{power}}\)
- qmetro.bounds.bounds.ad_bounds(channel, nmax, method='default', p=40, eps=0.0)[source]
Calculate adaptive (AD) bounds for the Quantum Fisher Information (QFI) [21, 27, 45].
This function computes the set of AD bounds for the QFIs of up to
nmaxchannels probed sequentially with arbitrary controls between, utilizing arbitrarily large ancilla.- Parameters:
channel (ParamChannel) – Object representing a single channel and its derivative
nmax (int) – Maximum number of channels for which the bounds are computed.
method (str, optional) – Method used to calculate bounds, there are two possibilities: - ‘default’: calculates the bound using the iterative procedure involving calculation of extended comb QFI described in [45]. - ‘ab_chart’: construct minimal alpha vs beta chart and then calculates the bound for each n [21]. Faster for large
nmax, may give slightly less tight bounds then ‘default’ (but asymptotically both methods are equivalent).p (int, optional) – Number of samples of beta for precision in bound calculation, by default 40, used for ‘ab_chart’ method only.
eps (float, optional) – Small epsilon added to beta bounds in sampling to avoid numerical issues, by default 0.0, used for ‘ab_chart’ method only.
- Returns:
Array of AD bounds for QFI with up to
nmaxchannels (starting fromn=1).- Return type:
np.ndarray
Calculate QFI bounds for adaptive strategies for general correlated models [27, 45].
This function computes the upper bounds for QFI when n copies of the given channel are linked using their environments. It is assumed that information leaks from environment aftery every block_size copies.
- Parameters:
channel (ParamChannel) – Object representing an elementary channel or comb and its derivative.
nmax (int) – Maximal number of elementary channels for which the bound is computed.
block_size (int) – The number of channels merged in one sub-chain during the algorithm. The larger it is, the tighter the bounds, but also computations are slower and more memory-consuming. It is denoted by m in [27, 45].
for_every_n (bool, optional) – When False (default), then the bound is calculated for number of copies which are multiples of block_size only. When True, bounds are computed for all number of copies up to nmax. In the latter case, the algorithm is slower, but bounds may be slightly tighter.
close_last_env (bool, optional) – When True, then it is assumed that in the last channel in the chain, no information leaks from environment. This makes the bounds slightly tighter but slows down the execution because the QFI with the environment leakage must be computed anyway for the sake of the next iteration step.
env_inp_state (np.ndarray|None, optional) – When specified, this state is contracted with first environment input of the chain. Otherwise, control can arbitrarily act on first input environment.
print_messages (bool, optional) – When True, then calculated bounds are printed in real time.
- Returns:
n_list (np.ndarray) – Array of n values (number of elementary channel copies) for which the bounds were computed.
bounds (np.ndarray) – Array of corresponding upper bounds for QFI.
- Return type:
tuple[ndarray, ndarray]
- qmetro.bounds.bounds.asym_scaling_qfi(channel, power=None)[source]
Calculate the scaling of QFI (with constant) when asymptotically many copies of an input channel are probed paralelly (PAR) using optimal input (possibly with ancilla) [12, 21, 27].
The result is also valid for optimal adaptive (AD) and causal superpostions (CS) strategy.
- Parameters:
channel (ParamChannel) – Object representing a single channel and its derivative
power (int | None optional) – Power in the QFI scaling law. It can be 1 (standard scaling) or 2 (Heisenberg scaling). When not provided, the scaling type is determined by the algorithm.
- Returns:
coef (float) – Coefficient in the QFI scaling law
power (int) – Power in the QFI scaling law. Can be 1 or 2.
- Return type:
tuple[float, int]
Notes
The QFI for asymptotically large number of channels n scales as coef * n ^ power.
- qmetro.bounds.bounds.beta_alpha_chart(krauses, dkrauses, p=20, eps=0.0)[source]
Generate a chart of minimal alpha values given constraints on beta [21].
This function calculates a list of minimal alpha values (a_list) for a range of beta values (b_list) for a given channel, for beta values between its minimum and the square root of the minimal alpha value.
- Parameters:
krauses (list[np.ndarray]) – List of Kraus operators, each represented as a 2D NumPy array.
dkrauses (list[np.ndarray]) – List of derivatives of Kraus operators, each represented as a 2D NumPy array.
p (int, optional) – Number of beta samples, by default 20.
eps (float, optional) – Small epsilon added to beta bounds to avoid numerical issues, by default 0.0.
- Returns:
b_list (np.ndarray) – Array of beta values sampled between the minimum beta and maximum alpha.
a_list (np.ndarray) – Array of minimal alpha values corresponding to each beta in b_list.
- Return type:
tuple[ndarray, ndarray]
Notes
This function first calculates bmin as the minimum achievable beta for the channel, and bmax as the square root of the minimum alpha. The b_list array is then generated with n samples between bmin + eps and bmax + 2*eps. For each beta value in b_list, the minimum alpha under that beta constraint is calculated using
minimize_alpha_given_beta.
- qmetro.bounds.bounds.cs_bounds(channel, nmax, p=40, eps=0.0)[source]
Calculate causal superpositions (CS) bounds for the Quantum Fisher Information (QFI) [21, 27].
This function computes the set of CS bounds for the QFIs of up to nmax channels probed using arbitrary causal superposition scheme involving arbitrary controls between channels. The alpha vs beta chart is constructed, and then the bound is computed
- Parameters:
channel (ParamChannel) – Object representing a single channel and its derivative
nmax (int) – Maximum number of channels for which the bounds are computed.
p (int, optional) – Number of samples of beta for precision in bound calculation, by default 40, used for ‘ab_chart’ method only.
eps (float, optional) – Small epsilon added to beta bounds in sampling to avoid numerical issues, by default 0.0, used for ‘ab_chart’ method only.
- Returns:
Array of CS bounds for QFI with up to nmax channels (starting from n=1).
- Return type:
np.ndarray
Computes the minimal ‘comb-norm’ of a correlated alpha matrix assuming beta_1=0 [45].
When the returned minimal a value is finite, then
Heisenberg scaling (HS) is not possible.
Asymptotic upper bound for Quantum Fisher Information (QFI) is 4 a N/m, m is the number of channels in comb, N is the total number of channels, and a is alpha.
- Parameters:
krauses_comb (list[np.ndarray]) –
- List of Kraus operators for the comb. Each operator is a linear
map from H_2m-1 x H_2m-3 x … x H_1 to H_2m x H_2m-2 x … x H_2.
dkrauses_comb (list[np.ndarray]) – List of derivatives of Kraus operators for the comb.
dims (tuple[int, ...]) – Dimensions of the spaces [H_1, H_2, …, H_2m].
- Returns:
The minimal value of a, representing the optimization result.
- Return type:
float
Notes
First input (H_1) and last output (H_2m) should also contain register spaces R containing information about correlations.
This is an implementation of algorithm from appendix C2 from . [45].
- qmetro.bounds.bounds.minimize_alpha_given_beta(krauses, dkrauses, bmax)[source]
Minimize the norm of alpha given a constraint on norm of beta [21, 27].
This function calculates the minimum norm of alpha over all possible Kraus representations for a channel, given a constraint that norm of beta is less than or equal to a specified maximum (bmax).
- Parameters:
krauses (list[np.ndarray]) – List of Kraus operators, each represented as a 2D NumPy array.
dkrauses (list[np.ndarray]) – List of derivatives of Kraus operators, each represented as a 2D NumPy array.
bmax (float) – Upper bound on beta for the optimization.
- Returns:
The minimum value of alpha given the constraint on beta.
- Return type:
float
- qmetro.bounds.bounds.minimize_beta(krauses, dkrauses)[source]
Minimize the norm of beta over all Kraus representations for a given channel [12, 27].
This function calculates the minimum norm of beta over all possible Kraus representations of a channel, given a list of Kraus operators and their derivatives.
- Parameters:
krauses (list[np.ndarray]) – List of Kraus operators, each represented as a 2D NumPy array.
dkrauses (list[np.ndarray]) – List of derivatives of Kraus operators, each represented as a 2D NumPy array.
- Returns:
The minimum value of norm of beta over all Kraus representations.
- Return type:
float
Computes the minimal ‘comb-norm’ of a correlated beta matrix [45].
The returned minimal b value has significant physical implications: - When b=0, Heisenberg scaling (HS) is not possible. - When b>0, asymptotic upper bound for Quantum Fisher Information (QFI) as 4 b^2 (N/m)^2, m is the number of channels in comb, N is the total number of channels.
- Parameters:
krauses_comb (list[np.ndarray]) – List of Kraus operators for the comb. Each operator is a linear map from H_2m-1 x H_2m-3 x … x H1 to H_2m x H_2m-2 x … x H2.
dkrauses_comb (list[np.ndarray]) – List of derivatives of Kraus operators for the comb.
dims (tuple[int, ...]) – Dimensions of the spaces [H1, H2, …, H_2m].
- Returns:
The minimal value of b, representing the optimization result.
- Return type:
float
Notes
First input (H_1) and last output (H_2m) should also contain register spaces R containing information about correlations.
This is an implementation of the algorithm from appendix C2 from [45].
- qmetro.bounds.bounds.par_ad_cs_bounds(channel, nmax, p=40, eps=0.0)[source]
Calculate parallel (PAR), adaptive (AD) and causal superpositions (CS) bounds for the Quantum Fisher Information (QFI) using alpha vs beta chart method [21, 27].
This function computes three sets of bounds, PAR, AD and CS by constructing list of minimal alpha for given beta constraints (see
beta_alpha_chart). It is equivalent to callingpar_bounds,ad_boundsandcs_boundsfunctions with method = ‘ab_chart’. Calling this function is faster, since alpha-beta chart is created only once.- Parameters:
channel (ParamChannel) – Object representing a single channel and its derivative
nmax (int) – Maximum number of channels for which the bounds are computed.
p (int, optional) – Number of samples of beta for precision in bound calculation, by default 40.
eps (float, optional) – Small epsilon added to beta bounds in sampling to avoid numerical issues, by default 0.0.
- Returns:
- A tuple containing:
- PAR_bounds_listnp.ndarray
Array of AD bounds for QFI with up to nmax channels (starting from n=1).
- AD_bounds_listnp.ndarray
Array of AD bounds for QFI with up to nmax channels (starting from n=1).
- CS_bounds_listnp.ndarray
Array of CS bounds for QFI with up to nmax channels (starting from n=1).
- Return type:
tuple of np.ndarray
- qmetro.bounds.bounds.par_bound_single_n(channel, n)[source]
Calculate parallel (PAR) bound for the Quantum Fisher Information (QFI) for a specific number of channels n [27, 29].
- Parameters:
channel (ParamChannel) – Object representing a single channel and its derivative
n (int) – Number of channels for which the bounds are computed.
- Returns:
PAR bounds for QFI for n channels probed in parallel.
- Return type:
float
- qmetro.bounds.bounds.par_bounds(channel, nmax, method='default', p=40, eps=0.0)[source]
Calculate parallel (par) bounds for the Quantum Fisher Information (QFI) [21, 27, 29].
This function computes the set of PAR bounds for the QFIs of up to nmax channels probed paralelly using arbitrary, possibly entangled probe (with ancilla).
- Parameters:
channel (ParamChannel) – Object representing a single channel and its derivative
nmax (int) – Maximum number of channels for which the bounds are computed.
method (str, optional) – Method used to calculate bounds, there are two possibilities: - ‘default’: calculates the bound by solving SDP for each number of channels separately. This method calls function par_bound_single_n for each n. - ‘ab_chart’: construct minimal alpha vs beta chart and then calculates the bound for each n. Faster for large nmax, may give slightly less tight bounds then ‘default’ (but asymptotically both methods are equivalent).
p (int, optional) – Number of samples of beta for precision in bound calculation, by default 40, used for ‘ab_chart’ method only.
eps (float, optional) – Small epsilon added to beta bounds in sampling to avoid numerical issues, by default 0.0, used for ‘ab_chart’ method only.
- Returns:
Array of PAR bounds for QFI with up to nmax channels (starting from n=1).
- Return type:
np.ndarray