/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ #ifndef Matrix2__ #define Matrix2__ 1 typedef double Element; typedef Element *Row; typedef Row *Matrix; /* constructor functions */ extern Matrix newMatrix( int h, int w ); extern Matrix zeroMatrix( int h, int w ); extern Matrix unitMatrix( int h, int w ); /* destructor */ extern void freeMatrix( Matrix m ); /* matrix ops */ extern Matrix addMatrix( Matrix m1, Matrix m2, int h, int w ); extern Matrix transposeMatrix( Matrix m, int h, int w ); /* element access ops */ /* unsave, unsave, unsave, ... */ #define at(m,i,j) ((m)[j][i]) #define setAt(m,i,j,v) ((m)[i][j] = (v), (m)) #endif