Dear All,
I want to know how to remove this type of error. In this code i want to flip the values. But if I flip by giving 1D array index it flips and no error but if i have 2D List its not working and give this error. Please help me in this regard. What I have to change.
My part of code in error is below:
For example:one part of decoding process
I want to know how to remove this type of error. In this code i want to flip the values. But if I flip by giving 1D array index it flips and no error but if i have 2D List its not working and give this error. Please help me in this regard. What I have to change.
My part of code in error is below:
For example:one part of decoding process
add_attempt=4 LLR_L = signal.copy() * 2 / pow(sigma, 2) LLR_L_ = LLR_L indexes = np.argsort(np.abs(LLR_L))[:add_attempt] comb =[] for i in indexes: comb.append(i) COMB = [] for L in range(0, len(comb) + 1): for subset in itertools.combinations(comb, L): COMB.append(subset) for i_flip in range(len(COMB)): L[:, n] = LLR_L_ decoding process function here( if fails) else: LLR_L_ = LLR_L for j in range(len(COMB[i_flip])): if LLR_L[COMB[i_flip][j]] > 0: LLR_L_[COMB[i_flip][j]] = (-1) * 10 else: LLR_L_[COMB[i_flip][j]] = 10This code have an output I print just to know what is stored in these functions and error
Output:indexes [ 3 14 5 22]
comb [3, 14, 5, 22]
COMB [(), (3,), (14,), (5,), (22,), (3, 14), (3, 5), (3, 22), (14, 5), (14, 22), (5, 22), (3, 14, 5), (3, 14, 22), (3, 5, 22), (14, 5, 22), (3, 14, 5, 22)]
errorOutput:Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "C:\Users\ankita1268\Desktop\CRC-BP-Multi-G\main_Iter_mflip.py", line 120, in func
polar_decoded_llr, a = polar_codes_iter_mflip.FG_decode(signal, polar_iter_num, stage_num, frozen_indexes, info_indexes, B_N, sigma, BIG_NUM, perm[perm_idx], alpha, beta, threshold, H_CRC,T)
File "C:\Users\ankita1268\Desktop\CRC-BP-Multi-G\polar_codes_iter_mflip.py", line 203, in FG_decode
L[:, n] = LLR_L_
TypeError: 'int' object does not support item assignment
"""
[color=#E74C3C] L[:, n] = LLR_L_
TypeError: 'int' object does not support item assignment[/color]
But this code runs if I have the last part of code as below:for i_flip in range(add_attempt): L[:, n] = LLR_L_ decoding process function here( if fails) else: LLR_L_ = LLR_L if LLR_L[indexes[i_flip]] > 0: LLR_L_[indexes[i_flip]] = (-1) * 10 else: LLR_L_[indexes[i_flip]] = 10