added matrix api (just mult by now)
[my-code/api.git] / matrix / matrix.h
diff --git a/matrix/matrix.h b/matrix/matrix.h
new file mode 100644 (file)
index 0000000..3d2ed19
--- /dev/null
@@ -0,0 +1,39 @@
+/* matrix.h -- matrix headers */
+
+#ifndef MATRIX_H
+#define MATRIX_H
+
+/* includes */
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+
+/* defines */
+#define M_SUCCESS 1
+#define M_ERROR -1
+#define M_NOT_SUPPORTED -2
+#define M_DIM_FAILURE -3
+#define M_ALLOC_FAIL -4
+
+typedef struct s_matrix {
+  int outfd;
+  unsigned char type;
+#define MULT (1<<0)
+#define ADD (1<<1)
+#define INV (1<<2)
+#define DIAG (1<<3)
+  int m,n,z;
+  double *m1;
+  double *m2;
+  double *res;
+} t_matrix;
+
+/* function prototypes */
+int matrix_init(t_matrix *matrix,int outfd);
+int matrix_alloc_data(t_matrix *matrix);
+int matrix_calc(t_matrix *matrix);
+int matrix_shutdown(t_matrix *matrix);
+
+#endif