Exemple #1
0
def get_frozen_bit_position():
    # frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 16, 17, 18, 20, 24), dtype=int)
    # frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int)
    m = 256
    n_frozen = m // 2
    frozenbitposition = cc.get_frozen_bit_indices_from_z_parameters(cc.bhattacharyya_bounds(0.0, m), n_frozen)
    print(frozenbitposition)
    return frozenbitposition
Exemple #2
0
def get_frozen_bit_position():
    # frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 16, 17, 18, 20, 24), dtype=int)
    # frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int)
    m = 256
    n_frozen = m // 2
    frozenbitposition = cc.get_frozen_bit_indices_from_z_parameters(cc.bhattacharyya_bounds(0.0, m), n_frozen)
    print(frozenbitposition)
    return frozenbitposition
Exemple #3
0
def systematic_encoder_decoder_chain_test():
    print('systematic encoder decoder chain test')
    block_size = int(2 ** 8)
    info_bit_size = block_size // 2
    ntests = 100
    frozenbitposition = cc.get_frozen_bit_indices_from_z_parameters(cc.bhattacharyya_bounds(0.0, block_size), block_size - info_bit_size)
    encoder = PolarEncoder(block_size, info_bit_size, frozenbitposition)
    decoder = PolarDecoder(block_size, info_bit_size, frozenbitposition)
    for i in range(ntests):
        bits = np.random.randint(2, size=info_bit_size)
        y = encoder.encode_systematic(bits)
        u_hat = decoder.decode_systematic(y)
        assert (bits == u_hat).all()
Exemple #4
0
def systematic_encoder_decoder_chain_test():
    print('systematic encoder decoder chain test')
    block_size = int(2**8)
    info_bit_size = block_size // 2
    ntests = 100
    frozenbitposition = cc.get_frozen_bit_indices_from_z_parameters(
        cc.bhattacharyya_bounds(0.0, block_size), block_size - info_bit_size)
    encoder = PolarEncoder(block_size, info_bit_size, frozenbitposition)
    decoder = PolarDecoder(block_size, info_bit_size, frozenbitposition)
    for i in range(ntests):
        bits = np.random.randint(2, size=info_bit_size)
        y = encoder.encode_systematic(bits)
        u_hat = decoder.decode_systematic(y)
        assert (bits == u_hat).all()