#include #include #include // function initGeMatrix /* Your Code here. */ // function printGeMatrix /* Your Code here. */ #ifndef COLMAJOR #define COLMAJOR 1 #endif int main() { printf("COLMAJOR = %d\n", COLMAJOR); size_t m = 5, n = 10; ptrdiff_t incRowA = COLMAJOR ? 0 : 0; // <- FIXME ptrdiff_t incColA = COLMAJOR ? 0 : 0; // <- FIXME // allocate memory for A double *A = malloc(m*n*sizeof(double)); if (!A) { abort(); } // initialize matrix A initGeMatrix(m, n, A, incRowA, incColA); // print matrix A printf("A =\n"); printGeMatrix(m, n, A, incRowA, incColA); // print how elements are stored in memory printf("memory layout of A:\n"); // use printGeMatrix! // <- Your code here // print a matrix view of A printf("A(0:2, 0:3) =\n"); printGeMatrix(0, 0, A, incRowA, incColA); // <- FIXME // print a matrix view of A printf("A(2:4, 3:8) =\n"); printGeMatrix(0, 0, A, incRowA, incColA); // <- FIXME // print a matrix view of A printf("A(2:4, 3:8)^T =\n"); printGeMatrix(0, 0, A, incRowA, incColA); // <- FIXME // release memory free(A); }