quara.protocol.qtomography.standard.standard_qpt module

class StandardQpt(states, povms, is_physicality_required=False, is_estimation_object=False, on_para_eq_constraint=False, eps_proj_physical=None, eps_truncate_imaginary_part=None, seed_data=None, schedules='all')[source]

Bases: quara.protocol.qtomography.standard.standard_qtomography.StandardQTomography

initialize standard quantum tomography class.

To inherit from this class, set the following instance variables in the constructor of the subclass.

  • _coeffs_0th: return value of get_coeffs_0th function.

  • _coeffs_1st: return value of get_coeffs_1st function.

  • _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.

  • states (List[quara.objects.state.State]) –

  • povms (List[quara.objects.povm.Povm]) –

  • is_physicality_required (bool) –

  • is_estimation_object (bool) –

  • on_para_eq_constraint (bool) –

  • eps_proj_physical (float) –

  • eps_truncate_imaginary_part (float) –

  • seed_data (int) –

  • schedules (Union[str, List[List[Tuple]]]) –

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

QOperation

Raises

NotImplementedError – this function does not be implemented in the subclass.

estimation_object_type()[source]
Return type

type

generate_empi_dist(schedule_index, gate, num_sum, seed_or_generator=None)[source]

Generate empirical distribution using the data generated from probability distribution of specified schedules.

Parameters
  • schedule_index (int) – schedule index.

  • gate (Gate) – true object.

  • num_sum (int) – the number of data to use to generate the experience distributions for each schedule.

  • seed_or_generator (Union[int, np.random.Generator], optional) – If the type is int, it is assumed to be a seed used to generate random data. If the type is Generator, it is used to generate random data. If argument is None, np.random is used to generate random data. Default value is None.

Returns

Generated empirical distribution.

Return type

Tuple[int, np.ndarray]

generate_empi_dists(gate, num_sum, seed_or_generator=None)[source]

Generate empirical distributions using the data generated from probability distributions of all schedules.

see generate_empi_dists()

Parameters
  • gate (quara.objects.gate.Gate) –

  • num_sum (int) –

  • seed_or_generator (Optional[Union[int, numpy.random._generator.Generator]]) –

Return type

List[Tuple[int, numpy.ndarray]]

generate_empi_dists_sequence(gate, num_sums, seed_or_generator=None)[source]
Parameters
  • gate (quara.objects.gate.Gate) –

  • num_sums (List[int]) –

  • seed_or_generator (Optional[Union[int, numpy.random._generator.Generator]]) –

Return type

List[List[Tuple[int, numpy.ndarray]]]

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

QOperation

Raises

NotImplementedError – this function does not be implemented in the subclass.

is_valid_experiment()[source]

returns whether the experiment is valid.

this function must be implemented in the subclass.

Returns

whether the experiment is valid.

Return type

bool

Raises

NotImplementedError – this function does not be implemented in the subclass.

num_outcomes(schedule_index)[source]

returns the number of outcomes of probability distribution of a schedule index.

Parameters

schedule_index (int) – a schedule index

Returns

the number of outcomes

Return type

int

property on_para_eq_constraint
calc_c_qpt(states, povms, schedules, on_para_eq_constraint)[source]
Parameters

on_para_eq_constraint (bool) –

Return type

Tuple[Dict[Tuple[int], Union[float, numpy.ndarray]]]