blob: 5a85c08c77581ca8215b20a363b05084ec46c050 (
plain) (
tree)
|
|
#ifndef NERV_GENERIC_MATRIX_H
#define NERV_GENERIC_MATRIX_H
#include <stddef.h>
#include <curand.h>
typedef struct Matrix {
size_t stride; /* size of a row */
long ncol, nrow, nmax; /* dimension of the matrix */
int dim; /* dim == 2 for a matrix, dim == 1 for row vector */
union {
float *f;
double *d;
long *i;
} data; /* pointer to actual storage */
long *data_ref;
curandGenerator_t *curand_gen;
} Matrix;
#define MATRIX_ROW_PTR(self, row) \
(MATRIX_ELEM *)((char *)MATRIX_ELEM_PTR(self) + (row) * (self)->stride)
#endif
|