quara.protocol.qtomography.standard.standard_qtomography module
- class StandardQTomography(experiment, set_qoperations)[source]
Bases:
quara.protocol.qtomography.qtomography.QTomographyinitialize standard quantum tomography class.
To inherit from this class, set the following instance variables in the constructor of the subclass.
_coeffs_0th: return value ofget_coeffs_0thfunction._coeffs_1st: return value ofget_coeffs_1stfunction._map_experiment_to_setqoperations: a map from indices of Experiment to indices of SetQOperations.if you map the 0th state to the 1st state, set
{("state", 0): ("state", 1)}.
_map_setqoperations_to_experiment: a map from indices of SetQOperations to indices of Experiment.
- Parameters
experiment (Experiment) – Experiment class used in quantum tomography.
set_qoperations (SetQOperations) – SetQOperations class used in quantum tomography.
- calc_covariance_linear_mat_total(qope, data_num_list)[source]
calculates covariance matrix of linear estimate of probability distributions.
- Parameters
qope (QOperation) – QOperation to calculate covariance matrix of linear estimate of probability distributions.
data_num_list (List[int]) – list of number of data.
- Returns
covariance matrix of linear estimate of probability distributions.
- Return type
np.ndarray
- calc_covariance_mat_single(qope, schedule_index, data_num)[source]
calculates covariance matrix of single probability distribution.
- Parameters
qope (QOperation) – QOperation to calculate covariance matrix of single probability distribution.
schedule_index (int) – schedule index.
data_num (int) – number of data.
- Returns
covariance matrix of single probability distribution.
- Return type
np.ndarray
- calc_covariance_mat_total(qope, data_num_list)[source]
calculates covariance matrix of total probability distributions.
- Parameters
qope (QOperation) – QOperation to calculate covariance matrix of total probability distributions.
data_num_list (List[int]) – list of number of data.
- Returns
covariance matrix of total probability distributions.
- Return type
np.ndarray
- calc_cramer_rao_bound(var, N, list_N)[source]
calculates Cramer-Rao bound.
- Parameters
var (Union[QOperation, np.ndarray]) – variables to calculate Cramer-Rao bound.
N (int) – representative value of the number of data.
list_N (List[int]) – the number of data for each schedule.
- Returns
Cramer-Rao bound.
- Return type
np.ndarray
- calc_fisher_matrix(j, var)[source]
calculates Fisher matrix of one schedule.
- Parameters
j (int) – schedule_index
var (Union[QOperation, np.ndarray]) – variables to calculate Fisher matrix of one schedule.
- Returns
Fisher matrix of one schedule.
- Return type
np.ndarray
- calc_fisher_matrix_total(var, weights)[source]
calculates Fisher matrix of the total schedule.
- Parameters
var (Union[QOperation, np.ndarray]) – variables to calculate Fisher matrix of one schedule.
weights (List[float]) – weights to calculate Fisher matrix of one schedule.
- Returns
Fisher matrix of the total schedule.
- Return type
np.ndarray
- calc_matA()[source]
returns the matrix A.
the matrix A is a stack of 1st coefficients.
- Returns
the matrix A.
- Return type
np.ndarray
- calc_mse_empi_dists_analytical(qope, data_num_list)[source]
calculates analytical solution of mean squared error of empirical distributions.
- Parameters
qope (QOperation) – QOperation to calculate analytical solution of mean squared error of empirical distributions.
data_num_list (List[int]) – list of number of data.
- Returns
analytical solution of mean squared error of empirical distributions.
- Return type
np.float64
- calc_mse_linear_analytical(qope, data_num_list, mode='qoperation')[source]
calculates mean squared error of linear estimate of probability distributions.
- Parameters
qope (QOperation) – QOperation to calculate mean squared error of linear estimate of probability distributions.
data_num_list (List[int]) – list of number of data.
mode (str) –
- Returns
mean squared error of linear estimate of probability distributions.
- Return type
np.float64
- calc_prob_dist(qope, schedule_index)[source]
calculates a probability distribution.
see
calc_prob_dist()- Parameters
qope (quara.objects.qoperation.QOperation) –
schedule_index (int) –
- Return type
List[float]
- calc_prob_dists(qope)[source]
calculates probability distributions.
- Parameters
qope (quara.objects.qoperation.QOperation) –
- Return type
List[List[float]]
- calc_vecB()[source]
returns the vector B.
the vector B is a stack of 0th coefficients.
- Returns
the vector B.
- Return type
np.ndarray
- abstract convert_var_to_qoperation(var)[source]
converts variable to QOperation.
this function must be implemented in the subclass.
- Parameters
var (np.ndarray) – variables.
- Returns
converted QOperation.
- Return type
- Raises
NotImplementedError – this function does not be implemented in the subclass.
- abstract generate_empty_estimation_obj_with_setting_info()[source]
generates the empty estimation object with setting information.
- Returns
the empty estimation object(QOperation) with setting information.
- Return type
- Raises
NotImplementedError – this function does not be implemented in the subclass.
- generate_prob_dists_sequence(true_object)[source]
- Parameters
true_object (quara.objects.qoperation.QOperation) –
- Return type
List[List[Tuple[int, numpy.ndarray]]]
- get_coeffs_0th(schedule_index, x)[source]
returns 0th coefficients specified by schedule index and measurement outcome index
- Parameters
schedule_index (int) – schedule index.
x (int) – measurement outcome index.
- Returns
0th coefficients.
- Return type
np.float64
- get_coeffs_0th_vec(schedule_index)[source]
returns 0th coefficient vector specified by schedule index.
- Parameters
schedule_index (int) – schedule index.
- Returns
0th coefficients vector
- Return type
np.ndarray( , dtype=np.float64)
- get_coeffs_1st(schedule_index, x)[source]
returns 1st coefficients specified by schedule index and measurement outcome index
- Parameters
schedule_index (int) – schedule index.
x (int) – measurement outcome index.
- Returns
1st coefficients.
- Return type
np.ndarray
- get_coeffs_1st_mat(schedule_index)[source]
returns 1st coefficient matrix specified by schedule index.
- Parameters
schedule_index (int) – schedule index.
- Returns
1st coefficient matrix.
- Return type
np.ndarray
- is_all_same_composite_systems(targets)[source]
check all qoperations have same composite systems.
- Parameters
targets (List[QOperation]) – list of qoperations.
- Returns
whether all qoperations have same composite systems.
- Return type
bool