#include "mm_simple.h" /* Copyright(C) 2003 Bradley C. Kuszmaul. * This code is licensed under the GPL. */ /********************************************** * Effect: perform matrix multiply C = A*B. * a is a pointer to the first element of matrix A, an m by n matrix. * b is a pointer to the first element of matrix B, an n by k matrix. * c is a pointer to the first element of matrix C, an m by k matrix. * * The matrices are stored in column-major order. That is A[I,J] is * adjacent to A[I+1,J] in memory. * * Rationale: Why lay out the arrays in column-major order, the way * FORTRAN does, instead of in row-major order the way C would if you * wrote * double a[N][M]; ? * Answer: Mainly because we want this code to be able to interoperate * with FORTRAN. * */ void mm_simple (int m, int n, int k, double *a, double *b, double *c) { #define A(I,J) a[(I)+(J)*n] #define B(J,L) b[(J)+(L)*k] #define C(I,L) c[(I)+(L)*k] int i,j,l; for (i=0; i