parameters: (mu, design_snr)
return_statement: return tpm
docstring: needed for Binary-AWGN channels.
      in [1] described in Section VI
      in [2] described as a function of the same name.
      in both cases reduce infinite output alphabet to a finite output alphabet of a given channel.
      idea:
      1. instantaneous capacity C(x) in interval [0, 1]
      2. split into mu intervals.
      3. find corresponding output alphabet values y of likelihood ratio function lambda(y) inserted into C(x)
      4. Calculate probability for each value given that a '0' or '1' is was transmitted.
docstring_summary: needed for Binary-AWGN channels.
      in [1] described in Section VI
      in [2] described as a function of the same name.
      in both cases reduce infinite output alphabet to a finite output alphabet of a given channel.
      idea:
      1. instantaneous capacity C(x) in interval [0, 1]
      2. split into mu intervals.
      3. find corresponding output alphabet values y of likelihood ratio function lambda(y) inserted into C(x)
      4. Calculate probability for each value given that a '0' or '1' is was transmitted.
docstring_tokens: needed for Binary - AWGN channels . in [ 1 ] described in Section VI in [ 2 ] described as a function of the same name . in both cases reduce infinite output alphabet to a finite output alphabet of a given channel . idea : 1 . instantaneous capacity C ( x ) in interval [ 0 1 ] 2 . split into mu intervals . 3 . find corresponding output alphabet values y of likelihood ratio function lambda ( y ) inserted into C ( x ) 4 . Calculate probability for each value given that a 0 or 1 is was transmitted .
function: def discretize_awgn(mu, design_snr):
      """
      needed for Binary-AWGN channels.
      in [1] described in Section VI
      in [2] described as a function of the same name.
      in both cases reduce infinite output alphabet to a finite output alphabet of a given channel.
      idea:
      1. instantaneous capacity C(x) in interval [0, 1]
      2. split into mu intervals.
      3. find corresponding output alphabet values y of likelihood ratio function lambda(y) inserted into C(x)
      4. Calculate probability for each value given that a '0' or '1' is was transmitted.
      """
      s = 10 ** (design_snr / 10)
      a = np.zeros(mu + 1, dtype=float)
      a[-1] = np.inf
      for i in range(1, mu):
          a[i] = solve_capacity(1.0 * i / mu, s)
  
      factor = np.sqrt(2 * s)
      tpm = np.zeros((2, mu))
      for j in range(mu):
          tpm[0][j] = q_function(factor + a[j]) - q_function(factor + a[j + 1])
          tpm[1][j] = q_function(-1.0 * factor + a[j]) - q_function(
              -1.0 * factor + a[j + 1]
          )
  
      tpm = tpm[::-1]
      tpm[0] = tpm[0][::-1]
      tpm[1] = tpm[1][::-1]
      return tpm
function_tokens: def discretize_awgn ( mu , design_snr ) : s = 10 ** ( design_snr / 10 ) a = np . zeros ( mu + 1 , dtype = float ) a [ - 1 ] = np . inf for i in range ( 1 , mu ) : a [ i ] = solve_capacity ( 1.0 * i / mu , s ) factor = np . sqrt ( 2 * s ) tpm = np . zeros ( ( 2 , mu ) ) for j in range ( mu ) : tpm [ 0 ] [ j ] = q_function ( factor + a [ j ] ) - q_function ( factor + a [ j + 1 ] ) tpm [ 1 ] [ j ] = q_function ( - 1.0 * factor + a [ j ] ) - q_function ( - 1.0 * factor + a [ j + 1 ] ) tpm = tpm [ : : - 1 ] tpm [ 0 ] = tpm [ 0 ] [ : : - 1 ] tpm [ 1 ] = tpm [ 1 ] [ : : - 1 ] return tpm