def create_board(processor_name: str, *, noise_mitigation: float): return qb.CirqBoard(init_basis_state=0, sampler=utils.get_sampler_by_name( processor_name, gateset='sqrt-iswap'), device=utils.get_device_obj_by_name(processor_name), error_mitigation=enums.ErrorMitigation.Correct, noise_mitigation=noise_mitigation)
square_to_bit, ) BIG_CIRQ_BOARDS = ( qb.CirqBoard(0, error_mitigation=enums.ErrorMitigation.Error), qb.CirqBoard(0, device=utils.get_device_obj_by_name('Syc54-noiseless'), error_mitigation=enums.ErrorMitigation.Error), ) ALL_CIRQ_BOARDS = BIG_CIRQ_BOARDS + ( qb.CirqBoard(0, device=utils.get_device_obj_by_name('Syc23-noiseless'), error_mitigation=enums.ErrorMitigation.Error), qb.CirqBoard(0, sampler=utils.get_sampler_by_name('Syc23-simulator-tester'), device=utils.get_device_obj_by_name('Syc23-simulator-tester'), error_mitigation=enums.ErrorMitigation.Correct, noise_mitigation=0.10), ) @pytest.mark.parametrize('board', ALL_CIRQ_BOARDS) def test_initial_state(board): """Tests basic functionality of boards and setting an initial state.""" b = board.with_state(u.squares_to_bitboard(['a1', 'b1', 'c1'])) samples = b.sample(100) assert len(samples) == 100 for x in samples: assert x == 7 probs = b.get_probability_distribution(100)