added matrix api (just mult by now)
[my-code/api.git] / matrix / matrix.h
1 /* matrix.h -- matrix headers */
2
3 #ifndef MATRIX_H
4 #define MATRIX_H
5
6 /* includes */
7 #define _GNU_SOURCE
8 #include <stdio.h>
9 #include <string.h>
10 #include <stdlib.h>
11 #include <math.h>
12
13 /* defines */
14 #define M_SUCCESS 1
15 #define M_ERROR -1
16 #define M_NOT_SUPPORTED -2
17 #define M_DIM_FAILURE -3
18 #define M_ALLOC_FAIL -4
19
20 typedef struct s_matrix {
21   int outfd;
22   unsigned char type;
23 #define MULT (1<<0)
24 #define ADD (1<<1)
25 #define INV (1<<2)
26 #define DIAG (1<<3)
27   int m,n,z;
28   double *m1;
29   double *m2;
30   double *res;
31 } t_matrix;
32
33 /* function prototypes */
34 int matrix_init(t_matrix *matrix,int outfd);
35 int matrix_alloc_data(t_matrix *matrix);
36 int matrix_calc(t_matrix *matrix);
37 int matrix_shutdown(t_matrix *matrix);
38
39 #endif