#include #include "matrix_lib.h" void mult(int size, int row, int column, matrix_t MA, matrix_t MB, matrix_t MC){ int position; MC[row][column] = 0; for(position = 0; position < size; position++) { MC[row][column] += (MA[row][position] * MB[position][column]); } } int one(int row, int column){ return 1; } int identity(int row, int column){ return ((row == column)? 1 : 0); } int sum(int row, int column){ return row + column + 1;} void matrix_init(int sz, matrix_t M, int (*init_fun)(int,int)){ int row, column; for (row = 0; row < sz; row++) { for (column = 0; column < sz; column++) { M[row][column] = (*init_fun)(row, column); } } } void matrix_printf(char* name, int sz, matrix_t M){ int row, column; printf("Matrix: The %s array is;\n", name); for(row = 0; row < sz; row ++) { for (column = 0; column < sz; column++) { printf("%5d ",M[row][column]); } printf("\n"); } }