Commit before starting over
Turns out I had the wrong problem statement. I'm given input in CG notation, but it is not enough to check under permutations for this representation. Therefore, I should instead first convert to joint probability representation before checking the permutations, which then become trivial.
This commit is contained in:
parent
1bf3c6a19d
commit
7346b90d76
|
@ -22,6 +22,9 @@ typedef struct
|
|||
// Prints a debug view of a `matrix_t` to standard output.
|
||||
void DebugPrintMatrix(matrix_t *matrix);
|
||||
|
||||
// Prints a row of a `matrix_t` to standard output.
|
||||
void PrintMatrixRow(matrix_t *matrix, size_t row);
|
||||
|
||||
// Parse a matrix from the standard input.
|
||||
//
|
||||
// This function parses an extended matrix (C|l), where C is an n×m matrix, and
|
||||
|
|
15
src/matrix.c
15
src/matrix.c
|
@ -24,6 +24,17 @@ void DebugPrintMatrix(matrix_t *matrix)
|
|||
printf("] }\n");
|
||||
}
|
||||
|
||||
// Prints a row of a `matrix_t` to standard output.
|
||||
void PrintMatrixRow(matrix_t *matrix, size_t row) {
|
||||
for (size_t entry = 0; entry < matrix->row_len; entry ++) {
|
||||
printf("%" PRImDATA, *(matrix->head + row * (matrix->row_len) + entry));
|
||||
if (entry != matrix->row_len - 1) {
|
||||
printf(", ");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// Parameters for `increase_input_buffers`.
|
||||
typedef struct
|
||||
{
|
||||
|
@ -119,7 +130,7 @@ matrix_t ParseMatrix(size_t row_len)
|
|||
if (spaces)
|
||||
{
|
||||
// New string
|
||||
len += 1;
|
||||
len++;
|
||||
scan_len = 0;
|
||||
|
||||
// Check if we need to resize the buffer.
|
||||
|
@ -138,7 +149,7 @@ matrix_t ParseMatrix(size_t row_len)
|
|||
|
||||
// Save the character to the entry string
|
||||
scan_str[scan_len] = scanned;
|
||||
scan_len += 1;
|
||||
scan_len++;
|
||||
|
||||
if (scan_len == 50)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue