aboutsummaryrefslogblamecommitdiff
path: root/matrix/generic/matrix.h
blob: 833724b061d41d08a82dd8acc559477bc9964ec1 (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                             
                   
                       
                                                   



                                                           
                


                                                             
 


                                                                           
      
#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