diff options
author | Determinant <ted.sybil@gmail.com> | 2015-06-24 22:48:24 +0800 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2015-06-24 22:48:24 +0800 |
commit | 5e407d74130accfbbf94d2cabcb03fc126a89410 (patch) | |
tree | 6d8998e904a31a95f85a6e64ac7f3940fb61af80 /nerv/lib/matrix/matrix.h | |
parent | 8f13607cba9d6cf4fc4a213ba5ae4bcd46f7e18d (diff) |
separate non-Lua part of matrix code to a dedicated dir
Diffstat (limited to 'nerv/lib/matrix/matrix.h')
-rw-r--r-- | nerv/lib/matrix/matrix.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nerv/lib/matrix/matrix.h b/nerv/lib/matrix/matrix.h new file mode 100644 index 0000000..cbf32c2 --- /dev/null +++ b/nerv/lib/matrix/matrix.h @@ -0,0 +1,19 @@ +#ifndef NERV_GENERIC_MATRIX_H +#define NERV_GENERIC_MATRIX_H + +#include <stddef.h> + +typedef struct Matrix { + size_t stride; /* size of a row */ + long ncol, nrow, nmax; /* dimension of the matrix */ + union { + float *f; + double *d; + long *i; + } data; /* pointer to actual storage */ + long *data_ref; +} Matrix; + +#define MATRIX_ROW_PTR(self, row) \ + (MATRIX_ELEM *)((char *)MATRIX_ELEM_PTR(self) + (row) * (self)->stride) +#endif |