/* This function reads in a block design and returns an (0,1)-matrix which istheincidencematrixofthedesign.Rowscorrespondtopointsand columnstoblocks.Rowandcolumnnumberingstartsat1.NOTETHAT
THE STORAGE MANAGER IS NOT INITIALIZED. */
/* Open input file. */
libFile = fopen( libFileName, "r"); if ( libFile == NULL )
ERROR1s( "readDesign", "File ", libFileName, " could not be opened for input.")
/* Open output file. */
libFile = fopen( libFileName, options.outputFileMode); if ( libFile == NULL )
ERROR1s( "writeDesign", "File ", libFileName, " could not be opened for output.")
/* This function reads in an (0,1)-matrix and returns a new matrix equal
to that read in. NOTE THAT THE STORAGE MANAGER IS NOT INITIALIZED. */
Matrix_01 *read01Matrix( char *libFileName, char *libName,
BOOLEAN transposeFlag, /* If true, matrix is transposed. */
BOOLEAN adjoinIdentity, /* If true, form (A|I), A = matrix read. */ Unsigned requiredSetSize, /* 0 = any */ Unsigned requiredNumberOfRows, /* 0 = any */ Unsigned requiredNumberOfCols) /* 0 = any */
{ Unsigned nRows, nCols, setSize;
Matrix_01 *matrix;
Token token, saveToken; char inputBuffer[81];
FILE *libFile; Unsigned i, j, temp; char matrixName[MAX_NAME_LENGTH+1], str[100];
BOOLEAN firstIdent;
/* Open input file. */
libFile = fopen( libFileName, "r"); if ( libFile == NULL )
ERROR1s( "read01Matrix", "File ", libFileName, " could not be opened for input.")
/* This function reads in an (0,1)-matrix in the alternate format and returns anewmatrixequaltothatreadin.Itiscalledonlybyread01Matrix.
NOTE THAT THE STORAGE MANAGER IS NOT INITIALIZED. */
static Matrix_01 *xRead01Matrix(
FILE *libFile, char *name,
BOOLEAN transposeFlag, /* If true, matrix is transposed. */ Unsigned requiredSetSize, /* 0 = any */ Unsigned requiredNumberOfRows, /* 0 = any */ Unsigned requiredNumberOfCols) /* 0 = any */
{ Unsigned nRows, nCols, setSize;
Matrix_01 *matrix; Unsigned i, j, temp; int symbol, maxSymbol;
/* Read the field or set size, the number of rows, and number of columns,
and exchange numbers if matrix is to be transposed. */ if ( fscanf( libFile, "%d %d %d", &setSize, &nRows, &nCols) != 3 )
ERROR( "xRead01Matrix", "Invalid syntax set size, rows count, or col count") if ( (requiredSetSize != 0 && setSize != requiredSetSize) ||
nRows < 1 ||
(requiredNumberOfRows != 0 && nRows != requiredNumberOfRows) ||
nCols < 1 ||
(requiredNumberOfCols != 0 && nCols != requiredNumberOfCols) )
ERROR( "xRead01Matrix", "Invalid syntax in matrix library.") if ( nRows + nCols > options.maxDegree )
ERROR( "xRead01Matrix", "Too many rows+columns.") if ( transposeFlag )
EXCHANGE( nRows, nCols, temp)
/* Allocate the (0,1) incidence matrix, and zero it. */
matrix = newZeroMatrix( setSize, nRows, nCols); if ( strlen(name) > MAX_NAME_LENGTH )
ERROR1i( "xRead01Matrix", "Name for code exceeds maximum of ",
MAX_NAME_LENGTH, " characters.")
strcpy( matrix->name, name);
/* Read the entries of the matrix in row-major order. */
maxSymbol = '0' + setSize - 1; if ( !transposeFlag ) for ( i = 1 ; i <= nRows ; ++i ) for ( j = 1 ; j <= nCols ; ++j ) { while ( (symbol = getc(libFile)) == ' ' || symbol == ',' || symbol == '\n' )
; if ( symbol < '0' && symbol > maxSymbol ) { if ( symbol == EOF )
ERROR( "xRead01Matrix", "Premature end of file.") else
ERROR( "xRead01Matrix", "Invalid symbol in matrix entries.")
}
matrix->entry[i][j] = symbol - '0';
} else for ( i = 1 ; i <= nCols ; ++i ) for ( j = 1 ; j <= nRows ; ++j ) { while ( (symbol = getc(libFile)) == ' ' || symbol == ',' || symbol == '\n' )
; if ( symbol < '0' && symbol > maxSymbol ) { if ( symbol == EOF )
ERROR( "xRead01Matrix", "Premature end of file.") else
ERROR( "xRead01Matrix", "Invalid symbol in matrix entries.")
}
matrix->entry[j][i] = symbol - '0';
}
/* Close the input file and return. */
fclose( libFile); return matrix;
}
/* Open output file. */
libFile = fopen( libFileName, options.outputFileMode); if ( libFile == NULL )
ERROR1s( "write01Matrix", "File ", libFileName, " could not be opened for output.")
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.30Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-26)
¤
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.