/* The function reduceBasis allocates an infoSet for a code (unless one is already allocated -- if so, it must have the right size) and then performs elementary row operations on the generator matrix in order to make
entry infoSet[j],i equal to delta(i,j). */
void reduceBasis(
Code *const C)
{ Unsigned row, col, i, j, mu;
if ( !C->infoSet )
C->infoSet = malloc( (C->dimension+2) * sizeof(Unsigned) ); for ( row = 1 ; row <= C->dimension ; ++row ) { for ( col = 1 ; col <= C->length && C->basis[row][col] == 0; ++col )
; if ( col > C->length )
ERROR( "reduceBasis", "Basis vectors not independent.")
C->infoSet[row] = col; if ( C->fieldSize == 2 ) for ( i = 1 ; i <= C->dimension ; ++i ) if ( i != row && C->basis[i][col] != 0 ) for ( j = 1 ; j <= C->length ; ++j )
C->basis[i][j] ^= C->basis[row][j]; else
; else {
mu = C->field->inv[C->basis[row][col]]; for ( j = 1 ; j <= C->length ; ++j )
C->basis[row][j] = C->field->prod[mu][C->basis[row][j]]; for ( i = 1 ; i <= C->dimension ; ++i ) if ( i != row && C->basis[i][col] != 0 ) {
mu = C->basis[i][col]; for ( j = 1 ; j <= C->length ; ++j )
C->basis[i][j] = C->field->dif[C->basis[i][j]]
[C->field->prod[mu][C->basis[row][j]]];
}
}
}
}
/* The function codeContainsVector( C, v) returns true is the vector v is contained in the code C and false otherwise. The vector v is destroyed. Here a vector is simply an array of characters. If C does not have a
canonical basis, one is constructed. */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.