Пример #1
0
def test_swap_network_permutation(part_lens, acquaintance_size):
    n_qubits = sum(part_lens)
    gate = SwapNetworkGate(part_lens, acquaintance_size)

    expected_permutation = {
        i: j
        for i, j in zip(range(n_qubits), reversed(range(n_qubits)))
    }
    assert gate.permutation(n_qubits) == expected_permutation
Пример #2
0
def test_swap_network_permutation_error():
    gate = SwapNetworkGate((1, 1))
    with pytest.raises(ValueError):
        gate.permutation(1)