I need to implement a very large matrix, say NxN in Standard C. The matrix must store a truth table, that is
matrix[i][j] = [true|false]
I know I could simply use a int matrix, or boolean type if using C99, but was looking for the most lightweight solution in terms of memory.
The most lightweight solution in terms of memory is saving eight boolean in a char:
Then you can store a
N x 8Mmatrix by saving the bytes in each row. If many of those bytes are empty then you should use a sparse matrix format, for example compressed spares row.