Exemple #1
0
def test_planar_y_decoder_partial_recovery(code, syndrome_index,
                                           expected_syndrome_indices):
    partial_recovery = PlanarYDecoder._partial_recovery(code, syndrome_index)
    print()
    print(code.new_pauli(partial_recovery))
    syndrome = pt.bsp(partial_recovery, code.stabilizers.T)
    syndrome_indices = code.syndrome_to_plaquette_indices(syndrome)
    assert syndrome_indices == expected_syndrome_indices, 'syndrome_indices not as expected'
Exemple #2
0
def test_planar_y_decoder_partial_recovery_idempotence():
    # tests for bug where destabilizer modified cached return value of _snake_fill
    code = PlanarCode(4, 3)
    syndrome_index = (2, 1)
    # create partial_recovery1, destabilzer and partial_recovery2, copying to test for changes
    partial_recovery1 = np.copy(
        PlanarYDecoder._partial_recovery(code, syndrome_index))
    destabilizer = np.copy(PlanarYDecoder._destabilizer(code, syndrome_index))
    partial_recovery2 = np.copy(
        PlanarYDecoder._partial_recovery(code, syndrome_index))
    print(code.new_pauli(partial_recovery1))
    print(code.new_pauli(destabilizer))
    print(code.new_pauli(partial_recovery2))
    assert np.array_equal(
        partial_recovery1,
        partial_recovery2), '_partial_recovery is not idempotent'
    assert not np.array_equal(
        partial_recovery2, destabilizer), '_partial_recovery == _destabilizer'
Exemple #3
0
def test_planar_y_decoder_residual_recovery(code, syndrome_index):
    partial_recovery = PlanarYDecoder._partial_recovery(code, syndrome_index)
    syndrome = pt.bsp(partial_recovery, code.stabilizers.T)
    residual_recovery = PlanarYDecoder._residual_recovery(code, syndrome)
    assert not np.any(partial_recovery ^ residual_recovery
                      ), 'Residual recovery does not match partial recovery'