aboutsummaryrefslogtreecommitdiff
path: root/include/globals.h
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2016-05-16 18:47:09 +0200
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2016-05-16 18:47:09 +0200
commit044dc5a93c33d7aa4c9c98a626890c16446a56fc (patch)
tree23cc17a595d36a35ad9cb50e3ab18c2956b5f65c /include/globals.h
parentMove includes to header (diff)
downloadgensvm-044dc5a93c33d7aa4c9c98a626890c16446a56fc.tar.gz
gensvm-044dc5a93c33d7aa4c9c98a626890c16446a56fc.zip
major refactor of the code
Diffstat (limited to 'include/globals.h')
-rw-r--r--include/globals.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/globals.h b/include/globals.h
index becde35..7fad7b1 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -18,12 +18,17 @@
#ifndef GENSVM_GLOBALS_H
#define GENSVM_GLOBALS_H
+#include "gensvm_memory.h"
+#include "types.h"
+
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
-
-#include "gensvm_memory.h"
+#include <math.h>
+#include <time.h>
+#include <cblas.h>
#define MAX_LINE_LENGTH 1024
@@ -33,4 +38,22 @@
#define minimum(a, b) (a) < (b) ? (a) : (b)
#endif
+// Set a matrix element (RowMajor)
+#define matrix_set(M, cols, i, j, val) M[(i)*(cols)+j] = val
+
+// Get a matrix element (RowMajor)
+#define matrix_get(M, cols, i, j) M[(i)*(cols)+j]
+
+// Add to a matrix element (RowMajor)
+#define matrix_add(M, cols, i, j, val) M[(i)*(cols)+j] += val
+
+// Multiply a matrix element (RowMajor)
+#define matrix_mul(M, cols, i, j, val) M[(i)*(cols)+j] *= val
+
+// Set a 3D matrix element (N2 = second dim, N3 = third dim, RowMajor)
+#define matrix3_set(M, N2, N3, i, j, k, val) M[k+(N3)*(j+(N2)*(i))] = val
+
+// Get a 3D matrix element (N2 = second dim, N3 = third dim, RowMajor)
+#define matrix3_get(M, N2, N3, i, j, k) M[k+(N3)*(j+(N2)*(i))]
+
#endif