id: variable_ldpc_decoder_def
label: LDPC Decoder Definition
flags: [ show_id ]

parameters:
-   id: value
    label: Ignore Me
    dtype: raw
    default: '"ok"'
    hide: all
-   id: ndim
    label: Parallelism
    dtype: enum
    default: '0'
    options: ['0', '1', '2']
-   id: dim1
    label: Dimension 1
    dtype: int
    default: '4'
    hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
-   id: dim2
    label: Dimension 2
    dtype: int
    default: '4'
    hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
-   id: file
    label: AList File
    dtype: file_open
-   id: max_iter
    label: Max Iterations
    dtype: int
    default: '50'
value: ${ value }

templates:
    imports: from gnuradio import fec
    var_make: |-
        % if int(ndim)==0:
        self.${id} = ${id} = fec.ldpc_decoder.make(${file}, ${max_iter})
        % elif int(ndim)==1:
        self.${id} = ${id} = list(map( (lambda a: fec.ldpc_decoder.make(${file}, ${max_iter})), range(0,${dim1})))
        % else:
        self.${id} = ${id} = list(map( (lambda b: list( map( ( lambda a: fec.ldpc_decoder.make(${file}, ${max_iter})), range(0,${dim2}) ) ) ), range(0,${dim1})))
        % endif

documentation: |-
    This is a soft-decision decoder that uses belief propagation (also known as message passing) that is described at:

    https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=ccb90917786903efded5a5536d67fdd1440929c0
    Reduced-Complexity Decoding of LDPC Codes by Jinghu Chen et al.

    This is the "tanh rule" algorithm described in equations 2. and 3.

    Designed for a memoryless AWGN channel.

file_format: 1
