quara.qcircuit.experiment module¶
- class Experiment(states, povms, gates, schedules, seed=None)[source]¶
Bases:
objectClass to manage experiment settings This class is not limited to tomography, but deals with general quantum circuits.
- Parameters
states (List[quara.objects.state.State]) –
povms (List[quara.objects.povm.Povm]) –
gates (List[quara.objects.gate.Gate]) –
schedules (List[List[Tuple[str, int]]]) –
seed (int) –
- Return type
None
- calc_prob_dist(schedule_index)[source]¶
Calculate the probability distributionthe by running the specified schedule.
- Parameters
schedule_index (int) – Index of the schedule
- Returns
Probability distribution
- Return type
np.ndarray
- Raises
ValueError – If the object referenced in the schedule, such as State, POVM, Gate, or Mprocess, is None.
- calc_prob_dists()[source]¶
Caluclate probability distributions for all schedules.
- Returns
Probability distributions for all schedules
- Return type
List[np.ndarray]
- property gates: List[quara.objects.gate.Gate]¶
- generate_data(schedule_index, data_num)[source]¶
Runs the specified schedule to caluclate the probability distribution and generate random data.
- Parameters
schedule_index (int) – Index of the schedule.
data_num (int) – Length of the data.
- Returns
Generated data.
- Return type
List[int]
- Raises
TypeError – [description]
ValueError – [description]
IndexError – [description]
- generate_dataset(data_nums)[source]¶
Run all the schedules to caluclate the probability distribution and generate random data.
- 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]]
- generate_empi_dist_sequence(schedule_index, num_sums)[source]¶
Generate an empirical distribution using the data generated from the probability distribution of a specified schedule.
Uses generated data from 0-th to
num_sums[index]-th to calculate empirical distributions.- Parameters
schedule_index (int) – Index of schedule.
num_sums (List[int]) – List of the number of data to caluclate the experience distribution
- Returns
A list of the numbers of data and empirical distribution.
- Return type
List[Tuple[int, np.ndarray]]
- generate_empi_dists_sequence(list_num_sums)[source]¶
Generate empirical distributions using the data generated from probability distributions of all specified schedules.
- Parameters
list_num_sums (List[List[int]]) – A list of the number of data to use to calculate the experience distribution for each schedule.
- Returns
A list of tuples for the number of data and experience distribution for each schedules.
- Return type
List[List[Tuple[int, np.ndarray]]]
- property povms: List[quara.objects.povm.Povm]¶
- property schedules: List[List[Tuple[str, int]]]¶
- property seed: int¶
- property states: List[quara.objects.state.State]¶