Cython macro definition in structure

1

I'm using Cython to import a structure to python from C while there are some macro definitions which include functions. I just don't how to realize the structure in Cython.

typedef struct _SparMat {
    int m, n;       

    int *rvec;      

    int *ridx;      
    double *rval;   

    int *cvec;      

    int *cidx;         
    double *cval;      

    int nnz;           
    int bufsz;         
    int incsz;         
    int flag;
#define MAT_ROWBASE_INDEX    (0x00000001)    
#define MAT_ROWBASE_VALUE    (0x00000002)
#define MAT_COLBASE_INDEX    (0x00000004)
#define MAT_COLBASE_VALUE    (0x00000008)
#define CSR_INDEX(flag)      ((flag) & MAT_ROWBASE_INDEX)
#define CSR_VALUE(flag)      ((flag) & MAT_ROWBASE_VALUE)
#define CSC_INDEX(flag)      ((flag) & MAT_COLBASE_INDEX)
#define CSC_VALUE(flag)      ((flag) & MAT_COLBASE_VALUE)
} SparMat, * matptr;
python
c
macros
structure
cython
asked on Stack Overflow May 11, 2018 by Icy

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0