/* PRINT-CODE.C - Print a Low Density Parity Check code's matrices. */ /* Copyright (c) 1995-2012 by Radford M. Neal. * * Permission is granted for anyone to copy, use, modify, and distribute * these programs and accompanying documents for any purpose, provided * this copyright notice is retained and prominently displayed, and note * is made of any changes made to these programs. These programs and * documents are distributed without any warranty, express or implied. * As the programs were written for research purposes only, they have not * been tested to the degree that would be advisable in any important * application. All use of these programs is entirely at the user's own * risk. */ #include #include #include #include #include "rand.h" #include "alloc.h" #include "open.h" #include "mod2sparse.h" #include "mod2dense.h" #include "mod2convert.h" #include "rcode.h" void usage(void); /* MAIN PROGRAM. */ int main ( int argc, char **argv ) { char *gen_file; int dprint; int i, j; dprint = 0; if (argc>1 && strcmp(argv[1],"-d")==0) { dprint = 1; argc -= 1; argv += 1; } if (!(gen_file = argv[1]) || argv[2]) { usage(); } read_gen(gen_file,0,1); switch (type) { case 's': { printf("\nGenerator matrix in %s (sparse representation):\n\n",gen_file); printf("Column order (message bits at end):\n"); for (j = 0; j