def test_max_weight_state_3(): states = [ plusX(0) * minusZ(1), plusX(0), minusZ(1), ] assert _max_weight_state(states) == states[0]
def test_max_weight_state_4(): states = [ plusX(1) * minusZ(0), plusX(0), minusZ(1), ] assert _max_weight_state(states) is None
def _expt_settings_diagonal_in_tpb(es1: ExperimentSetting, es2: ExperimentSetting): """ Extends the concept of being diagonal in the same tpb to ExperimentSettings, by determining if the pairs of in_states and out_operators are separately diagonal in the same tpb """ max_weight_in = _max_weight_state([es1.in_state, es2.in_state]) max_weight_out = _max_weight_operator([es1.out_operator, es2.out_operator]) return max_weight_in is not None and max_weight_out is not None
def test_expt_settings_share_ntpb(): expts = [[ ExperimentSetting(zeros_state([0, 1]), sX(0) * sI(1)), ExperimentSetting(zeros_state([0, 1]), sI(0) * sX(1)) ], [ ExperimentSetting(zeros_state([0, 1]), sZ(0) * sI(1)), ExperimentSetting(zeros_state([0, 1]), sI(0) * sZ(1)) ]] for group in expts: for e1, e2 in itertools.combinations(group, 2): assert _max_weight_state([e1.in_state, e2.in_state]) is not None assert _max_weight_operator([e1.out_operator, e2.out_operator]) is not None