aboutsummaryrefslogtreecommitdiff
path: root/nerv/lib/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'nerv/lib/common.h')
-rw-r--r--nerv/lib/common.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/nerv/lib/common.h b/nerv/lib/common.h
index 3283ac1..3d98574 100644
--- a/nerv/lib/common.h
+++ b/nerv/lib/common.h
@@ -61,6 +61,21 @@ typedef struct Status {
nerv_error_status(L, &status); \
} while (0)
+#define CHECK_SAME_DIMENSION(a, b, status) \
+ do { \
+ if (!(a->nrow == b->nrow && a->ncol == b->ncol)) \
+ NERV_EXIT_STATUS(status, MAT_MISMATCH_DIM, 0); \
+ } while (0)
+
+#define CHECK_SAME_DIMENSION_RET(a, b, status) \
+ do { \
+ if (!(a->nrow == b->nrow && a->ncol == b->ncol)) \
+ { \
+ NERV_SET_STATUS(status, MAT_MISMATCH_DIM, 0); \
+ return 0; \
+ } \
+ } while (0)
+
typedef struct HashNode {
const char *key;
void *val;