-
Notifications
You must be signed in to change notification settings - Fork 1
/
Matrix.h
48 lines (41 loc) · 1.07 KB
/
Matrix.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//Matrix.h
//Matrix definitions for use in the C Programming language
//Please use in conjunction with MatMachine.c which includes the required
//C std libraries
//Nov 2010
//***********************
//for a matrix type data size MUST == (row*col)
typedef struct{
int row;
int col;
float* data;
}Matrix;
/*typedef struct{
int (*allocMatrix)(Matrix m) = 0;
int (*freeMatrix)(int mNum) = 0;
float (*MatrixSum)(int mNum) = 0;
}MatFace;
*/
/*
The above was an experiment for polymorphism. Unnecessary for a traditional
interface. In following elements are stats of the "machine" operation
as a whole.
int mats;
int* rs;
int* cs;
int* sid;
float* matData;
*/
//Interface for basic matrix operations
//This is a matrix machine posed as an interface.
typedef struct{
int (*initMachine)(int mdsz);
int (*releaseMachine)(void);
int (*allocMatrix)(Matrix m);
int (*freeMatrix)(int mNum);
Matrix (*getMatrix)(int mNum);
Matrix (*addMatrices)(int matID1, int matID2);
Matrix (*getHilbertMat) (int size);
}MatMachine;
//
extern MatMachine* createMatMach(int version); //restrict with #define VERSION