Ejemplo n.º 1
0
def get_z_params(is_prototype, channel, block_size, design_snr, mu):
    print('POLAR code channel construction called with parameters channel={0}, blocksize={1}, design SNR={2}, mu={3}'.format(channel, block_size, design_snr, mu))
    if not (channel == 'AWGN' or channel == 'BEC'):
        raise ValueError("channel is {0}, but only BEC and AWGN are supported!".format(channel))
    if not is_power_of_two(block_size):
        raise ValueError("block size={0} is not a power of 2!".format(block_size))
    if design_snr < -1.5917:
        raise ValueError("design SNR={0} < -1.5917. MUST be greater!".format(design_snr))
    if not mu > 0:
        raise ValueError("mu={0} < 1. MUST be > 1!".format(mu))
    if not is_prototype and channel == 'AWGN':
        z_params = cc.load_z_parameters(block_size, design_snr, mu)
        print('Read Z-parameter file: {0}'.format(cc.default_dir() + cc.generate_filename(block_size, design_snr, mu)))
        return z_params
    return bhattacharyya_bounds(design_snr, block_size)
Ejemplo n.º 2
0
def main():
    np.set_printoptions(precision=3, linewidth=150)
    print 'channel construction Bhattacharyya bounds by Arikan'
    n = 10
    m = 2 ** n
    k = m // 2
    design_snr = 0.0
    mu = 32

    z_params = load_z_parameters(m, design_snr, mu)
    z_bounds = bhattacharyya_bounds(design_snr, m)
    print(z_params[-10:])
    plt.plot(z_params)
    plt.plot(z_bounds)
    plt.show()
Ejemplo n.º 3
0
def get_z_params(is_prototype, channel, block_size, design_snr, mu):
    print('POLAR code channel construction called with parameters channel={0}, blocksize={1}, design SNR={2}, mu={3}'.format(channel, block_size, design_snr, mu))
    if not (channel == 'BSC' or channel == 'BEC'):
        raise ValueError("channel is {0}, but only BEC and BSC are supported!".format(channel))
    if not is_power_of_two(block_size):
        raise ValueError("block size={0} is not a power of 2!".format(block_size))
    if design_snr < -1.5917:
        raise ValueError("design SNR={0} < -1.5917. MUST be greater!".format(design_snr))
    if not mu > 0:
        raise ValueError("mu={0} < 1. MUST be > 1!".format(mu))
    if not is_prototype and channel == 'BSC':
        z_params = cc.load_z_parameters(block_size, design_snr, mu)
        print('Read Z-parameter file: {0}'.format(cc.default_dir() + cc.generate_filename(block_size, design_snr, mu)))
        return z_params
    return bhattacharyya_bounds(design_snr, block_size)
def upper_bound_z_params(z, block_size, design_snr):
    upper_bound = bhattacharyya_bounds(design_snr, block_size)
    z = np.minimum(z, upper_bound)
    return z
Ejemplo n.º 5
0
 def tal_vardy_tpm_algorithm(block_size, design_snr, mu):
     return bhattacharyya_bounds(design_snr, block_size)
def upper_bound_z_params(z, block_size, design_snr):
    upper_bound = bhattacharyya_bounds(design_snr, block_size)
    z = np.minimum(z, upper_bound)
    return z
Ejemplo n.º 7
0
 def tal_vardy_tpm_algorithm(block_size, design_snr, mu):
     return bhattacharyya_bounds(design_snr, block_size)