@@ -2727,3 +2727,75 @@ function(ax, bx, k)
27272727 return C;
27282728end );
27292729
2730+ # ##########################################################################
2731+ # #
2732+ # F QCLDPCCodeFromGroup( <m>, <j>, <k> ) . . Regular quasi-cyclic LDPC code
2733+ # #
2734+ # # Construct a regular (j,k) quasi-cyclic low-density parity-check (LDPC)
2735+ # # code over GF(2) based on the multiplicative group of integer modulo m.
2736+ # # If m is a prime, the size of the group is equal to Phi(m) = m - 1,
2737+ # # otherwise it is equal to Phi(m). For details, refer to the paper by:
2738+ # #
2739+ # # R. Tanner, D. Sridhara, A. Sridharan, T. Fuja and D. Costello,
2740+ # # "LDPC block and convolutional codes based on circulant matrices",
2741+ # # IEEE Trans. Inform. Theory, vol. 50, no. 12, pp. 2966--2984, 2004
2742+ # #
2743+ # # NOTE that j and k must divide Phi(m).
2744+ # #
2745+ InstallMethod(QCLDPCCodeFromGroup, " method for binary linear code" , true ,
2746+ [ IsInt, IsInt, IsInt] , 0 ,
2747+ function (m, j, k )
2748+ local r, c, a, b, p, P, H, M, C, PermutationMatrix;
2749+
2750+ # #
2751+ # #----------------- start of private functions ---------------------
2752+ # #
2753+ # # PermutationMatrix - a private function for QCLDPCCodeFromGroup
2754+ PermutationMatrix := function (m, i )
2755+ local s, P, L;
2756+ if i = 0 or i > m then
2757+ Error(" invalid value of i, 1 \\ le i \\ le " , m, " \n " );
2758+ fi ;
2759+ P := [] ;
2760+ L := List([ 1 .. m] , i-> Zero(GF(2 ))); L[ i] := One(GF(2 ));
2761+ Append(P, [ L ] );
2762+ for s in [ 2 .. m] do ;
2763+ L := RightRotateList(L);
2764+ Append(P, [ L ] );
2765+ od ;
2766+ return P;
2767+ end ;
2768+ # #
2769+ # #------------------ end of private functions ----------------------
2770+ # #
2771+
2772+ p := Phi(m);
2773+ if (p mod j <> 0 ) then
2774+ Error(j, " does not divide " , p, " =Phi(" , m, " )\n " );
2775+ fi ;
2776+ if (p mod k <> 0 ) then
2777+ Error(k, " does not divide " , p, " =Phi(" , m, " )\n " );
2778+ fi ;
2779+
2780+ a := Position( List([ 1 .. m- 1 ] , i-> OrderMod(i, m) ), k );
2781+ b := Position( List([ 1 .. m- 1 ] , i-> OrderMod(i, m) ), j );
2782+
2783+ P := [] ;
2784+ for r in [ 0 .. j- 1 ] do ;
2785+ Append(P, [ List([ 0 .. k- 1 ] , i-> a^ i* b^ r mod m) ] );
2786+ od ;
2787+
2788+ H := [] ;
2789+ for r in [ 1 .. j] do ;
2790+ M := [] ;
2791+ for c in [ 1 .. k] do ;
2792+ M := TransposedMat( Concatenation( TransposedMat(M), TransposedMat( PermutationMatrix(m, P[ r][ c] ) ) ) );
2793+ od ;
2794+ Append(H, M);
2795+ od ;
2796+ C := CheckMatCode( H, GF(2 ) );
2797+ C!. CheckMat := H;
2798+ C!. name := " low-density parity-check code" ;
2799+ C!. upperBoundMinimumDistance := Factorial(j+ 1 );
2800+ return C;
2801+ end );
0 commit comments