quara.protocol.qtomography.qtomography module
- class QTomography(experiment, set_qoperations)[source]
Bases:
objectinitialize quantum tomography class.
To inherit from this class, set the following instance variables in the constructor of the subclass.
_num_variables: sum of the number of all variables.
- Parameters
experiment (Experiment) – Experiment class used in quantum tomography, which is supposed to have tester objects.
set_qoperations (SetQOperations) – SetQOperations class used in quantum tomography, which is supposed to have conditions of true object.
- abstract calc_prob_dist(qope, schedule_index)[source]
calculates a probability distribution.
this function must be implemented in the subclass.
- Parameters
qope (QOperation) – QOperation to calculate a probability distribution.
schedule_index (int) – schedule index.
- Returns
a probability distribution.
- Return type
List[np.ndarray]
- Raises
NotImplementedError – this function does not be implemented in the subclass.
- abstract calc_prob_dists(qope)[source]
calculates probability distributions.
this function must be implemented in the subclass.
- Parameters
qope (QOperation) – QOperation to calculate probability distributions.
- Returns
probability distributions.
- Return type
List[List[np.ndarray]]
- Raises
NotImplementedError – this function does not be implemented in the subclass.
- property experiment: quara.qcircuit.experiment.Experiment
returns Experiment class.
- Returns
Experiment class.
- Return type
- property gates: List[quara.objects.gate.Gate]
- abstract generate_dataset(data_nums)[source]
Run all the schedules to caluclate the probability distribution and generate random data.
this function must be implemented in the subclass.
- Parameters
data_nums (List[int]) – A list of the number of data to be generated in each schedule. This parameter should be a list of non-negative integers.
- Returns
Generated dataset.
- Return type
List[List[np.ndarray]]
- Raises
NotImplementedError – this function does not be implemented in the subclass.
- abstract generate_empi_dists(qoperation, num_sum)[source]
Generate empirical distributions using the data generated from probability distributions of all schedules.
this function must be implemented in the subclass.
- Parameters
qoperation (QOperation) – QOperation to use to generate the experience distributions.
num_sum (int) – the number of data to use to generate the experience distributions for each schedule.
- Returns
A list of tuples for the number of data and experience distributions for each schedules.
- Return type
List[Tuple[int, np.ndarray]]
- Raises
NotImplementedError – this function does not be implemented in the subclass.
- abstract 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.
- property mprocesses: List[quara.objects.mprocess.MProcess]
- property num_schedules: int
returns number of schedules.
- Returns
number of schedules.
- Return type
int
- property num_variables: int
returns sum of the number of all variables.
- Returns
sum of the number of all variables.
- Return type
int
- property povms: List[quara.objects.povm.Povm]
- reset_seed(seed=None)[source]
reset new seed.
if seed is None, reset by seed which Experiment already has.
- Parameters
seed (int, optional) – new seed, None by default.
- Return type
None
- property set_qoperations: quara.objects.qoperations.SetQOperations
returns SetQOperations class.
- Returns
SetQOperations class.
- Return type
- property states: List[quara.objects.state.State]
- property testers: List[quara.objects.qoperation.QOperation]
returns tester objects.
- Returns
tester objects.
- Return type
List[QOperation]
- Raises
NotImplementedError – this function does not be implemented in the subclass.