gk_mkutils.h
Go to the documentation of this file.
1 
10 #ifndef _GK_MKUTILS_H_
11 #define _GK_MKUTILS_H_
12 
13 
14 #define GK_MKARRAY2CSR(PRFX, TYPE)\
15 /*************************************************************************/\
16 \
17 /**************************************************************************/\
18 void PRFX ## array2csr(TYPE n, TYPE range, TYPE *array, TYPE *ptr, TYPE *ind)\
19 {\
20  TYPE i;\
21 \
22  for (i=0; i<=range; i++)\
23  ptr[i] = 0;\
24 \
25  for (i=0; i<n; i++)\
26  ptr[array[i]]++;\
27 \
28  /* Compute the ptr, ind structure */\
29  MAKECSR(i, range, ptr);\
30  for (i=0; i<n; i++)\
31  ind[ptr[array[i]]++] = i;\
32  SHIFTCSR(i, range, ptr);\
33 }
34 
35 
36 #define GK_MKARRAY2CSR_PROTO(PRFX, TYPE)\
37  void PRFX ## array2csr(TYPE n, TYPE range, TYPE *array, TYPE *ptr, TYPE *ind);\
38 
39 
40 #endif


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:08