<?xml version="1.0"?>
<!--
###################################################
# FEC LDPC ENCODER DEFINITION (PARITY CHECK)
###################################################
 -->
<block>
    <name>LDPC Encoder Definition (via Parity Check)</name>
    <key>variable_ldpc_encoder_H_def</key>
    <import>from gnuradio import fec</import>
    <var_make>
#if int($ndim())==0 #
self.$(id) = $(id) = fec.ldpc_par_mtrx_encoder_make_H($H)
#else if int($ndim())==1 #
self.$(id) = $(id) = map((lambda a: fec.ldpc_par_mtrx_encoder_make_H($H)), range(0,$dim1)) #slurp
#else
self.$(id) = $(id) = map((lambda b: map((lambda a: fec.ldpc_par_mtrx_encoder_make_H($H)), range(0,$dim2))), range(0,$dim1)) #slurp
#end if</var_make>
    <make></make>

    <param>
        <name>Ignore Me</name>
        <key>value</key>
        <value>"ok"</value>
        <type>raw</type>
        <hide>all</hide>
    </param>

    <param>
        <name>Parallelism</name>
        <key>ndim</key>
        <value></value>
        <type>enum</type>
        <option>
            <name>0</name>
            <key>0</key>
        </option>
        <option>
            <name>1</name>
            <key>1</key>
        </option>
        <option>
            <name>2</name>
            <key>2</key>
        </option>
    </param>

    <param>
        <name>Dimension 1</name>
        <key>dim1</key>
        <value>1</value>
        <type>int</type>
        <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
    </param>

    <param>
        <name>Dimension 2</name>
        <key>dim2</key>
        <value>1</value>
        <type>int</type>
        <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
    </param>

    <param>
        <name>Parity Check Matrix</name>
        <key>H</key>
        <value></value>
        <type>raw</type>
    </param>
  <doc>
This block creates a LDPC Encoder Definition variable.

This encoder performs a reduced complexity algorithm described by Richardson and Urbanke in Appendix A of their book: Modern Coding Theory. Compared to the block "LDPC Encoder Definition (via Generator)," this encoder requires orders of magnitude fewer operations to create each codeword. This is accomplished by completing a significant amount of the complex matrix manipulation (including inverse, multiplication, and Gaussian elimination operations) during preprocessing. The disadvantage of this encoder is that it requires a specially formatted matrix. However, GNU Radio includes python scripts to format a standard parity check matrix appropriately for this encoder, as well as a small library of encoding-ready matrices for use.
  </doc>
</block>
