12 # define GLOBAL_OPTS_H 24 #elif defined USE_CHOLMOD 33 #define Int SuiteSparse_long 34 #define Int_max SuiteSparse_long_max 35 #define CHOLMOD(name) cholmod_l_ ## name 37 #define ITYPE CHOLMOD_LONG 38 #define DTYPE CHOLMOD_DOUBLE 39 #define ID SuiteSparse_long_id 50 #define Int_max INT_MAX 51 #define CHOLMOD(name) cholmod_ ## name 52 #define ITYPE CHOLMOD_INT 53 #define DTYPE CHOLMOD_DOUBLE 86 static void*
c_calloc(
size_t num,
size_t size) {
87 void *m = mxCalloc(num, size);
88 mexMakeMemoryPersistent(m);
93 void *m = mxMalloc(size);
95 mexMakeMemoryPersistent(m);
99 static void*
c_realloc(
void *ptr,
size_t size) {
100 void *m = mxRealloc(ptr, size);
102 mexMakeMemoryPersistent(m);
106 # define c_free mxFree 107 # elif defined PYTHON 112 # define c_malloc PyMem_Malloc 113 # if PY_MAJOR_VERSION >= 3 114 # define c_calloc PyMem_Calloc 116 static void*
c_calloc(
size_t num,
size_t size) {
117 void *m = PyMem_Malloc(num * size);
119 memset(m, 0, num * size);
125 # define c_free PyMem_Free 126 # define c_realloc PyMem_Realloc 128 # define c_malloc malloc 129 # define c_calloc calloc 131 # define c_realloc realloc 146 # define c_print mexPrintf 148 # elif defined PYTHON 150 # define c_print(...) {PyGILState_STATE gstate; gstate = PyGILState_Ensure(); PySys_WriteStdout(__VA_ARGS__); PyGILState_Release(gstate);} 151 # elif defined R_LANG 152 # include <R_ext/Print.h> 153 # define c_print Rprintf 155 # define c_print printf 159 # define c_eprint(...) c_print("ERROR in %s: ", __FUNCTION__); c_print( \ 160 __VA_ARGS__); c_print("\n"); 170 # define c_absval(x) (((x) < 0) ? -(x) : (x)) 174 # define c_max(a, b) (((a) > (b)) ? (a) : (b)) 178 # define c_min(a, b) (((a) < (b)) ? (a) : (b)) 182 # define mod(a,b) ((((a)%(b))+(b))%(b)) #define c_malloc
custom malloc
Definition: global_opts.h:128
#define c_calloc
custom calloc
Definition: global_opts.h:129
#define c_realloc
custom realloc
Definition: global_opts.h:131
ladel_int c_int
type for integer numbers
Definition: global_opts.h:22
ladel_double c_float
type for floating point numbers
Definition: global_opts.h:21