?? mod2dense.html
字號:
</A><A NAME="get"><HR><B>mod2dense_get</B>: Get an element of a dense modulo-2 matrix.</A><BLOCKQUOTE><PRE>int mod2dense_get ( mod2dense *m, /* Pointer to matrix to get element from */ int row, /* Row of element (indexed from zero) */ int col /* Column of element (indexed from zero) */)</PRE></BLOCKQUOTE>Returns the value (0 or 1) of the element in the given row and columnof the matrix <B>m</B>.<P><A NAME="set"><HR><B>mod2dense_set</B>: Set an element of a dense modulo-2 matrix.</A><BLOCKQUOTE><PRE>void mod2dense_set( mod2dense *m, /* Pointer to matrix to get element from */ int row, /* Row of element (indexed from zero) */ int col, /* Column of element (indexed from zero) */ int value /* New value of element (0 or 1) */)</PRE></BLOCKQUOTE>Set the element in the given row and column of the matrix <B>m</B> tothe specified value.<P><A NAME="flip"><HR><B>mod2dense_flip</B>: Flip an element of a dense modulo-2 matrix.</A><BLOCKQUOTE><PRE>int mod2dense_flip( mod2dense *m, /* Pointer to matrix to get element from */ int row, /* Row of element (indexed from zero) */ int col /* Column of element (indexed from zero) */)</PRE></BLOCKQUOTE>Flips the value of the element in the given row and column of the matrix <B>m</B>, changing it to 0 if it was 1, and to 1 if it was 0.Returns the new value of this element.<A NAME="arith-sec"><P><HR><CENTER><BIG>Dense Modulo-2 Matrix Arithmetic and Comparison</BIG></CENTER></A><A NAME="transpose"><HR><B>mod2dense_transpose</B>: Compute the transpose of a dense modulo-2 matrix.</A><BLOCKQUOTE><PRE>void mod2dense_transpose( mod2dense *m, /* Matrix to compute transpose of */ mod2dense *r /* Result of transpose operation */)</PRE></BLOCKQUOTE>Stores the transpose of its first argument, <B>m</B>, in the matrixpointed to by its second argument, <B>r</B>, which must already havebeen allocated, and which must have as many rows as <B>m</B> hascolumns, and as many columns as <B>m</B> has rows. The two matrices<B>m</B> and <B>r</B> must not be the same (ie, the two pointerspassed must be different).<P><A NAME="add"><HR><B>mod2dense_add</B>: Add two dense modulo-2 matrices.</A><BLOCKQUOTE><PRE>void mod2dense_add( mod2dense *m1, /* Left operand of add */ mod2dense *m2, /* Right operand of add */ mod2dense *r /* Place to store result of add */)</PRE></BLOCKQUOTE>Adds matrices <B>m1</B> and <B>m2</B>, storing the result in thematrix pointed to by <B>r</B>. All three matrices must have the samenumbers of rows and columns. It is permissible for <B>r</B> to be thesame as <B>m1</B> and/or <B>m2</B>. Neither of the first two matrices ischanged by this procedure (unless they are the same as <B>r</B>).<P><A NAME="multiply"><HR><B>mod2dense_multiply</B>: Multiply two dense modulo-2 matrices.</A><BLOCKQUOTE><PRE>void mod2dense_multiply ( mod2dense *m1, /* Left operand of multiply */ mod2dense *m2, /* Right operand of multiply */ mod2dense *r /* Place to store result of multiply */)</PRE></BLOCKQUOTE>Does a matrix multiplication of <B>m1</B> by <B>m2</B>, and stores theresult in the matrix pointed to by <B>r</B>. The matrices must havecompatible numbers of rows and columns. Neither of the first twomatrices is changed by this procedure. The result matrix, <B>r</B>,must not be the same as either <B>m1</B> or <B>m2</B>.<P>The algorithm used runs faster if <B>m2</B> contains mostly 0s, butit is also appropriate for matrices with many 1s.<P><A NAME="equal"><HR><B>mod2dense_equal</B>: Check whether two dense modulo-2 matrices are equal.</A><BLOCKQUOTE><PRE>int mod2dense_equal( mod2dense *m1, /* Pointers to the two matrices */ mod2dense *m2 /* to compare */)</PRE></BLOCKQUOTE>Returns one if every element of <B>m1</B> is equal to thecorresponding element of <B>m2</B>, and otherwise returns zero. Thetwo matrices must have the same number of rows and the same number ofcolumns.<A NAME="invert-sec"><P><HR><CENTER><BIG>Dense Modulo-2 Matrix Inversion</BIG></CENTER></A><A NAME="invert"><HR><B>mod2dense_invert</B>: Invert a dense modulo-2 matrix.</A><BLOCKQUOTE><PRE>int mod2dense_invert( mod2dense *m, /* Matrix to find inverse of (destroyed) */ mod2dense *r /* Place to store the inverse */)</PRE></BLOCKQUOTE><P>Inverts the first matrix passed, <B>m</B>, and stores its inverse inthe second matrix, <B>r</B>. The contents of <B>m</B> are destroyedby this operation, though it remains a valid matrix for storing intolater. The matrix <B>m</B> must have the same number of rows ascolumns. The matrix <B>r</B> must already have been allocated, andmust have the same number of rows and columns as <B>m</B>. Thetwo matrices passed must not be the same.<P>The value returned is one if the inversion was successful and zeroif the matrix turned out to be singular (in which case the contents ofboth the original matrix and the result matrix will be garbage).<P>The algorithm used is based on inverting M by transforming the equationMI = M to the equation MR = I using column operations, at which point R is the inverse of M. The representation of matrices used allows easyswapping of columns as needed by fiddling pointers.<P><A NAME="forcibly_invert"><HR><B>mod2dense_forcibly_invert</B>: Forcibly invert a matrix by changing bits if necessary.</A><BLOCKQUOTE><PRE>int mod2dense_forcibly_invert( mod2dense *m, /* Matrix to find inverse of (destroyed) */ mod2dense *r, /* Place to store the inverse */ int *a_row, /* Place to store row indexes of altered elements */ int *a_col /* Place to store column indexes of altered elements */)</PRE></BLOCKQUOTE><P>Inverts the first matrix passed, <B>m</B>, and stores its inversein the second matrix, <B>r</B>, proceeding with the inversion even if<B>m</B> is singular, by changing some elements as necessary. Thecontents of <B>m</B> are destroyed by this operation, though itremains a valid matrix for storing into later. The matrix <B>m</B>must have the same number of rows as columns. The matrix <B>r</B>must already have been allocated, and must have the same number ofrows and columns as <B>m</B>. The two matrices passed must not be thesame.<P>The value returned is the number of elements of <B>m</B> that hadto be changed to make inversion possible (zero, if the original matrixwas non-singular). The row and column indexes of the elements of theoriginal matrix that were changed are stored in the arrays passed asthe last two elements. These arrays must have as many elements as thedimension of the matrix. (This is so even if it is known that fewerelements than this will be changed, as these arrays are also used astemporary storage by this routine.)<P>See <A HREF="#invert"><TT>mod2dense_invert</TT></A> for the algorithm used.<P><A NAME="invert_selected"><HR><B>mod2dense_invert_selected</B>: Invert a matrix with columns selected from a bigger matrix.</A><BLOCKQUOTE><PRE>int mod2dense_invert_selected ( mod2dense *m, /* Matrix from which a submatrix is inverted (destroyed) */ mod2dense *r, /* Place to store the inverse */ int *rows, /* Place to store indexes of rows used and not used */ int *cols /* Place to store indexes of columns used and not used */)</PRE></BLOCKQUOTE><P>Inverts a matrix obtained by selecting certain columns from thefirst matrix passed, <B>m</B>, which must have at least as manycolumns as rows. The second matrix passed, <B>r</B>, must alreadyexist, and must have the same number of rows and columns as <B>m</B>.The result of inverting the sub-matrix of <B>m</B> is stored in thecorresponding columns of <B>r</B>, with the other columns being set togarbage (or zero, see below). Normally, one would extract just therelevant columns afterwards using <AHREF="#copycols"><TT>mod2dense_copycols</TT></A>.) The contents of<B>m</B> are destroyed (though it remains a valid matrix for storinginto later. The two matrices passed must not be the same.<P>The indexes of the columns selected are stored, in order, in the lastargument, <B>cols</B>, followed by the columns not selected (inarbitrary order). The argument <B>rows</B> is set to the indexes ofthe rows used, which will be simply the indexes from zero up if thematrix is invertible, and will otherwise give an ordering that allowsthe inversion to proceed as far as possible.<P>The value returned is zero if an invertible matrix was found, andis otherwise the number of columns/rows that are redundant (ie, theamount by which matrix falls short of being of full rank). Ifinversion fails, partial results are stored in the columns and rows of<B>r</B> identified by the initial portions of <B>cols</B> and<B>rows</B>, such that if these rows and columns were extracted intheir new order, they would constitute the inverse of thecorresponding re-ordered submatrix of <B>m</B>. The remaining portionof <B>cols</B> up to the number of rows in <B>m</B> will containindexes of columns of <B>r</B> that are selected arbitrarily; thesecolumns will, however, be set to contain all zeros.<P>Note that when the first matrix is square, and non-singular, theresult is NOT in general the same as that obtained by calling <AHREF="#invert"></TT>mod2dense_invert</TT></A>, since that procedureorders the columns of the inverse so that it applies to the originalordering of the columns of the first matrix.<P>See <A HREF="#invert"><TT>mod2dense_invert</TT></A> for the algorithm used.<HR><A HREF="index.html">Back to index for LDPC software</A></BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -