#include #include "size.h" #include "matmult.h" static void naive_multiply_mat(int, int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE]); static void rep_multiply_mat(int, int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE]); static void sparse_multiply_mat(int, int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE]); static void rtcg_multiply_mat(int, int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE]); void (*select_function(char *name))(int, int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE], int [MAX_SIZE][MAX_SIZE]) { if ( !strcmp(name, "naive") ) return naive_multiply_mat; else if ( !strcmp(name, "rep") ) return rep_multiply_mat; else if ( !strcmp(name, "sparse") ) return sparse_multiply_mat; else if ( !strcmp(name, "rtcg") ) return rtcg_multiply_mat; else return NULL; } /* ** matrix multiplication: naive version */ static void naive_multiply_mat(int size, int M[MAX_SIZE][MAX_SIZE], int N[MAX_SIZE][MAX_SIZE], int R[MAX_SIZE][MAX_SIZE]) { int i,j,k; int dp; for (i=0; i