7575
7676#include "LG_internal.h"
7777#include "LAGraphX.h"
78- void shift_and
78+ void LG_SE_shift_and
7979 (uint16_t * z , const uint16_t * x )
8080 {
8181 (* z ) = (* x ) & ((* x ) << 8 );
8282 (* z ) |= (* z ) >> 8 ;
8383 }
8484#define SHIFT_AND \
85- "void shift_and \n"\
85+ "void LG_SE_shift_and \n"\
8686" (uint16_t *z, const uint16_t *x) \n"\
8787" { \n"\
8888" (*z) = (*x) & ((*x) << 8); \n"\
@@ -92,41 +92,41 @@ void shift_and
9292typedef struct {
9393 uint64_t a ;
9494 uint64_t b ;
95- } edge_type64 ;
95+ } LG_SE_edge_type64 ;
9696#define EDGE_TYPE64 \
97- "typedef struct { uint64_t a; uint64_t b; } edge_type64 ;"
97+ "typedef struct { uint64_t a; uint64_t b; } LG_SE_edge_type64 ;"
9898
9999typedef struct {
100100 uint64_t a ;
101101 uint64_t b ;
102102 uint64_t c ;
103103 uint64_t d ;
104- } swap_type64 ;
104+ } LG_SE_swap_type64 ;
105105#define SWAP_TYPE64 \
106106"typedef struct { \n"\
107107" uint64_t a; uint64_t b; uint64_t c; uint64_t d; \n"\
108- "} swap_type64 ;"
108+ "} LG_SE_swap_type64 ;"
109109
110110typedef struct {
111111 uint32_t a ;
112112 uint32_t b ;
113- } edge_type32 ;
113+ } LG_SE_edge_type32 ;
114114#define EDGE_TYPE32 \
115- "typedef struct { uint32_t a; uint32_t b; } edge_type32 ;"
115+ "typedef struct { uint32_t a; uint32_t b; } LG_SE_edge_type32 ;"
116116
117117typedef struct {
118118 uint32_t a ;
119119 uint32_t b ;
120120 uint32_t c ;
121121 uint32_t d ;
122- } swap_type32 ;
122+ } LG_SE_swap_type32 ;
123123#define SWAP_TYPE32 \
124124"typedef struct { \n"\
125125" uint32_t a; uint32_t b; uint32_t c; uint32_t d; \n"\
126- "}swap_type32 ;"
126+ "}LG_SE_swap_type32 ;"
127127
128- void swap_bc64
129- (swap_type64 * z , const swap_type64 * x , GrB_Index I , GrB_Index J , const bool * y )
128+ void LG_SE_swap_bc64
129+ (LG_SE_swap_type64 * z , const LG_SE_swap_type64 * x , GrB_Index I , GrB_Index J , const bool * y )
130130{
131131 memcpy (z , x , sizeof (* z )) ; //unnessesary when aliassed but done for safety.
132132 if (z -> a == z -> c || z -> b == z -> c || z -> a == z -> d || z -> b == z -> d ) return ;
@@ -143,8 +143,8 @@ void swap_bc64
143143 z -> b = temp ;
144144 }
145145}
146- void swap_bc32
147- (swap_type32 * z , const swap_type32 * x , GrB_Index I , GrB_Index J , const bool * y )
146+ void LG_SE_swap_bc32
147+ (LG_SE_swap_type32 * z , const LG_SE_swap_type32 * x , GrB_Index I , GrB_Index J , const bool * y )
148148{
149149 memcpy (z , x , sizeof (* z )) ; //unnessesary when aliassed but done for safety.
150150 if (z -> a == z -> c || z -> b == z -> c || z -> a == z -> d || z -> b == z -> d ) return ;
@@ -161,9 +161,9 @@ void swap_bc32
161161 z -> b = temp ;
162162 }
163163}
164- #define SWAP_BC64 \
165- "void swap_bc64 \n"\
166- "(swap_type64 *z, const swap_type64 *x, GrB_Index I, GrB_Index J, const bool *y)\n"\
164+ #define SWAP_BC64 \
165+ "void LG_SE_swap_bc64 \n"\
166+ "(LG_SE_swap_type64 *z, const LG_SE_swap_type64 *x, GrB_Index I, GrB_Index J, const bool *y)\n"\
167167"{ \n"\
168168" memcpy(z, x, sizeof(*z)) ; //unnessesary when aliassed but done for safety.\n"\
169169" if(z->a == z->c || z->b == z->c || z->a == z->d || z->b == z->d ) return; \n"\
@@ -180,9 +180,9 @@ void swap_bc32
180180" z->b = temp; \n"\
181181" } \n"\
182182"}"
183- #define SWAP_BC32 \
184- "void swap_bc32 \n"\
185- "(swap_type32 *z, const swap_type32 *x, GrB_Index I, GrB_Index J, const bool *y)\n"\
183+ #define SWAP_BC32 \
184+ "void LG_SE_swap_bc32 \n"\
185+ "(LG_SE_swap_type32 *z, const LG_SE_swap_type32 *x, GrB_Index I, GrB_Index J, const bool *y)\n"\
186186"{ \n"\
187187" memcpy(z, x, sizeof(*z)) ; //unnessesary when aliassed but done for safety.\n"\
188188" if(z->a == z->c || z->b == z->c || z->a == z->d || z->b == z->d ) return; \n"\
@@ -202,8 +202,8 @@ void swap_bc32
202202
203203// using xorshift, from https://en.wikipedia.org/wiki/Xorshift
204204// with a state of uint64_t, or xorshift64star.
205- void hash_edge64
206- (uint64_t * z , const edge_type64 * x , const uint64_t * mask )
205+ void LG_SE_hash_edge64
206+ (uint64_t * z , const LG_SE_edge_type64 * x , const uint64_t * mask )
207207{
208208 (* z ) = x -> a ^ x -> b ;
209209 (* z ) ^= (* z ) << 13 ;
@@ -212,8 +212,8 @@ void hash_edge64
212212 (* z ) ^= (* z ) << 17 ;
213213 (* z ) &= (* mask );
214214}
215- void hash_edge32
216- (uint64_t * z , const edge_type32 * x , const uint64_t * mask )
215+ void LG_SE_hash_edge32
216+ (uint64_t * z , const LG_SE_edge_type32 * x , const uint64_t * mask )
217217{
218218 (* z ) = x -> a ^ x -> b ;
219219 (* z ) ^= (* z ) << 13 ;
@@ -223,91 +223,91 @@ void hash_edge32
223223 (* z ) &= (* mask );
224224}
225225#define HASH_EDGE64 \
226- "void hash_edge64 \n"\
227- "(uint64_t *z, const edge_type64 *x, const uint64_t *mask) \n"\
226+ "void LG_SE_hash_edge64 \n"\
227+ "(uint64_t *z, const LG_SE_edge_type64 *x, const uint64_t *mask) \n"\
228228"{ \n"\
229229" (*z) = x->a ^ x->b; \n"\
230- " (*z) ^= (*z) << 13; \n"\
231- " (*z) ^= (*z) >> 7; \n"\
230+ " (*z) ^= (*z) << 13; \n"\
231+ " (*z) ^= (*z) >> 7; \n"\
232232" (*z) ^= (uint64_t)((x->a < x->b)? x->a: x->b); \n"\
233- " (*z) ^= (*z) << 17; \n"\
233+ " (*z) ^= (*z) << 17; \n"\
234234" (*z) &= (*mask); \n"\
235235"}"
236236#define HASH_EDGE32 \
237- "void hash_edge32 \n"\
238- "(uint64_t *z, const edge_type32 *x, const uint64_t *mask) \n"\
237+ "void LG_SE_hash_edge32 \n"\
238+ "(uint64_t *z, const LG_SE_edge_type32 *x, const uint64_t *mask) \n"\
239239"{ \n"\
240240" (*z) = x->a ^ x->b; \n"\
241- " (*z) ^= (*z) << 13; \n"\
242- " (*z) ^= (*z) >> 7; \n"\
241+ " (*z) ^= (*z) << 13; \n"\
242+ " (*z) ^= (*z) >> 7; \n"\
243243" (*z) ^= (uint64_t)((x->a < x->b)? x->a: x->b); \n"\
244- " (*z) ^= (*z) << 17; \n"\
244+ " (*z) ^= (*z) << 17; \n"\
245245" (*z) &= (*mask); \n"\
246246"}"
247247
248- void add_term
248+ void LG_SE_add_term
249249 (int8_t * z , const int8_t * x , const int8_t * y )
250250{
251251 (* z ) = (* x ) | (* y ) + ((int8_t )1 & (* x ) & (* y )) ;
252252}
253- #define ADD_TERM \
254- "void add_term \n"\
253+ #define ADD_TERM \
254+ "void LG_SE_add_term \n"\
255255"(int8_t *z, const int8_t *x, const int8_t *y) \n"\
256256"{ \n"\
257257" (*z) = (*x) | (*y) + ((int8_t)1 & (*x) & (*y)) ; \n"\
258258"}"
259259
260- void edge2nd64_bool
261- (edge_type64 * z , const bool * x , const edge_type64 * y )
260+ void LG_SE_edge2nd64_bool
261+ (LG_SE_edge_type64 * z , const bool * x , const LG_SE_edge_type64 * y )
262262{
263263 z -> a = y -> a ;
264264 z -> b = y -> b ;
265265}
266- void edge2nd32_bool
267- (edge_type32 * z , const bool * x , const edge_type32 * y )
266+ void LG_SE_edge2nd32_bool
267+ (LG_SE_edge_type32 * z , const bool * x , const LG_SE_edge_type32 * y )
268268{
269269 z -> a = y -> a ;
270270 z -> b = y -> b ;
271271}
272- void edge2nd64_edge
273- (edge_type64 * z , const edge_type64 * x , const edge_type64 * y )
272+ void LG_SE_edge2nd64_edge
273+ (LG_SE_edge_type64 * z , const LG_SE_edge_type64 * x , const LG_SE_edge_type64 * y )
274274{
275275 z -> a = y -> a ;
276276 z -> b = y -> b ;
277277}
278- void edge2nd32_edge
279- (edge_type32 * z , const edge_type32 * x , const edge_type32 * y )
278+ void LG_SE_edge2nd32_edge
279+ (LG_SE_edge_type32 * z , const LG_SE_edge_type32 * x , const LG_SE_edge_type32 * y )
280280{
281281 z -> a = y -> a ;
282282 z -> b = y -> b ;
283283}
284- #define EDGE2ND32_BOOL \
285- "void edge2nd32_bool \n"\
286- "(edge_type32 *z, const bool *x, const edge_type32 *y) \n"\
284+ #define EDGE2ND32_BOOL \
285+ "void LG_SE_edge2nd32_bool \n"\
286+ "(LG_SE_edge_type32 *z, const bool *x, const LG_SE_edge_type32 *y) \n"\
287287"{ \n"\
288288" //if(y->a == 0 && y->b == 0) return; \n"\
289289" z->a = y->a; \n"\
290290" z->b = y->b; \n"\
291291"}"
292- #define EDGE2ND64_BOOL \
293- "void edge2nd64_bool \n"\
294- "(edge_type64 *z, const bool *x, const edge_type64 *y) \n"\
292+ #define EDGE2ND64_BOOL \
293+ "void LG_SE_edge2nd64_bool \n"\
294+ "(LG_SE_edge_type64 *z, const bool *x, const LG_SE_edge_type64 *y) \n"\
295295"{ \n"\
296296" //if(y->a == 0 && y->b == 0) return; \n"\
297297" z->a = y->a; \n"\
298298" z->b = y->b; \n"\
299299"}"
300- #define EDGE2ND32_EDGE \
301- "void edge2nd32_edge \n"\
302- "(edge_type32 *z, const edge_type32 *x, const edge_type32 *y) \n"\
300+ #define EDGE2ND32_EDGE \
301+ "void LG_SE_edge2nd32_edge \n"\
302+ "(LG_SE_edge_type32 *z, const LG_SE_edge_type32 *x, const LG_SE_edge_type32 *y)\n"\
303303"{ \n"\
304304" //if(y->a == 0 && y->b == 0) return; \n"\
305305" z->a = y->a; \n"\
306306" z->b = y->b; \n"\
307307"}"
308- #define EDGE2ND64_EDGE \
309- "void edge2nd64_edge \n"\
310- "(edge_type64 *z, const edge_type64 *x, const edge_type64 *y) \n"\
308+ #define EDGE2ND64_EDGE \
309+ "void LG_SE_edge2nd64_edge \n"\
310+ "(LG_SE_edge_type64 *z, const LG_SE_edge_type64 *x, const LG_SE_edge_type64 *y)\n"\
311311"{ \n"\
312312" //if(y->a == 0 && y->b == 0) return; \n"\
313313" z->a = y->a; \n"\
@@ -484,64 +484,64 @@ int LAGr_SwapEdges
484484 if (codei == GrB_UINT32_CODE ) // Use uint32 if possible
485485 {
486486 GRB_TRY (GxB_Type_new (
487- & lg_edge , sizeof (edge_type32 ), "edge_type32 " , EDGE_TYPE32 )) ;
487+ & lg_edge , sizeof (LG_SE_edge_type32 ), "LG_SE_edge_type32 " , EDGE_TYPE32 )) ;
488488 GRB_TRY (GxB_Type_new (
489- & lg_swap , sizeof (swap_type32 ), "swap_type32 " , SWAP_TYPE32 )) ;
489+ & lg_swap , sizeof (LG_SE_swap_type32 ), "LG_SE_swap_type32 " , SWAP_TYPE32 )) ;
490490 GRB_TRY (GxB_BinaryOp_new (
491- & hash_seed_e , (GxB_binary_function ) (& hash_edge32 ),
492- GrB_UINT64 , lg_edge , GrB_UINT64 , "hash_edge32 " , HASH_EDGE32
491+ & hash_seed_e , (GxB_binary_function ) (& LG_SE_hash_edge32 ),
492+ GrB_UINT64 , lg_edge , GrB_UINT64 , "LG_SE_hash_edge32 " , HASH_EDGE32
493493 )) ;
494494 GRB_TRY (GxB_IndexUnaryOp_new (
495- & swap_pair , (GxB_index_unary_function ) (& swap_bc32 ),
496- lg_swap , lg_swap , GrB_BOOL , "swap_bc32 " , SWAP_BC32
495+ & swap_pair , (GxB_index_unary_function ) (& LG_SE_swap_bc32 ),
496+ lg_swap , lg_swap , GrB_BOOL , "LG_SE_swap_bc32 " , SWAP_BC32
497497 )) ;
498498 GRB_TRY (GxB_BinaryOp_new (
499- & second_edge , (GxB_binary_function ) (& edge2nd32_edge ),
500- lg_edge , lg_edge , lg_edge , "edge2nd32_edge " , EDGE2ND32_EDGE
499+ & second_edge , (GxB_binary_function ) (& LG_SE_edge2nd32_edge ),
500+ lg_edge , lg_edge , lg_edge , "LG_SE_edge2nd32_edge " , EDGE2ND32_EDGE
501501 )) ;
502502 GRB_TRY (GxB_BinaryOp_new (
503- & second_bool_edge , (GxB_binary_function ) (& edge2nd32_bool ),
504- lg_edge , GrB_BOOL , lg_edge , "edge2nd32_bool " , EDGE2ND32_BOOL
503+ & second_bool_edge , (GxB_binary_function ) (& LG_SE_edge2nd32_bool ),
504+ lg_edge , GrB_BOOL , lg_edge , "LG_SE_edge2nd32_bool " , EDGE2ND32_BOOL
505505 )) ;
506506 }
507507 else //uint64 types
508508 {
509509 GRB_TRY (GxB_Type_new (
510- & lg_edge , sizeof (edge_type64 ), "edge_type64 " , EDGE_TYPE64 )) ;
510+ & lg_edge , sizeof (LG_SE_edge_type64 ), "LG_SE_edge_type64 " , EDGE_TYPE64 )) ;
511511 GRB_TRY (GxB_Type_new (
512- & lg_swap , sizeof (swap_type64 ), "swap_type64 " , SWAP_TYPE64 )) ;
512+ & lg_swap , sizeof (LG_SE_swap_type64 ), "LG_SE_swap_type64 " , SWAP_TYPE64 )) ;
513513 GRB_TRY (GxB_BinaryOp_new (
514- & hash_seed_e , (GxB_binary_function ) (& hash_edge64 ),
515- GrB_UINT64 , lg_edge , GrB_UINT64 , "hash_edge64 " , HASH_EDGE64
514+ & hash_seed_e , (GxB_binary_function ) (& LG_SE_hash_edge64 ),
515+ GrB_UINT64 , lg_edge , GrB_UINT64 , "LG_SE_hash_edge64 " , HASH_EDGE64
516516 )) ;
517517 GRB_TRY (GxB_IndexUnaryOp_new (
518- & swap_pair , (GxB_index_unary_function ) (& swap_bc64 ),
519- lg_swap , lg_swap , GrB_BOOL , "swap_bc64 " , SWAP_BC64
518+ & swap_pair , (GxB_index_unary_function ) (& LG_SE_swap_bc64 ),
519+ lg_swap , lg_swap , GrB_BOOL , "LG_SE_swap_bc64 " , SWAP_BC64
520520 )) ;
521521 GRB_TRY (GxB_BinaryOp_new (
522- & second_edge , (GxB_binary_function ) (& edge2nd64_edge ),
523- lg_edge , lg_edge , lg_edge , "edge2nd64_edge " , EDGE2ND64_EDGE
522+ & second_edge , (GxB_binary_function ) (& LG_SE_edge2nd64_edge ),
523+ lg_edge , lg_edge , lg_edge , "LG_SE_edge2nd64_edge " , EDGE2ND64_EDGE
524524 )) ;
525525 GRB_TRY (GxB_BinaryOp_new (
526- & second_bool_edge , (GxB_binary_function ) (& edge2nd64_bool ),
527- lg_edge , GrB_BOOL , lg_edge , "edge2nd64_bool " , EDGE2ND64_BOOL
526+ & second_bool_edge , (GxB_binary_function ) (& LG_SE_edge2nd64_bool ),
527+ lg_edge , GrB_BOOL , lg_edge , "LG_SE_edge2nd64_bool " , EDGE2ND64_BOOL
528528 )) ;
529529 }
530530
531531 GRB_TRY (GxB_UnaryOp_new (
532- & lg_shiftland , (GxB_unary_function ) (& shift_and ),
533- GrB_UINT16 , GrB_UINT16 , "shift_and " , SHIFT_AND
532+ & lg_shiftland , (GxB_unary_function ) (& LG_SE_shift_and ),
533+ GrB_UINT16 , GrB_UINT16 , "LG_SE_shift_and " , SHIFT_AND
534534 )) ;
535535 GRB_TRY (GxB_BinaryOp_new (
536- & add_term_biop , (GxB_binary_function ) (& add_term ),
537- GrB_INT8 , GrB_INT8 , GrB_INT8 , "add_term " , ADD_TERM
536+ & add_term_biop , (GxB_binary_function ) (& LG_SE_add_term ),
537+ GrB_INT8 , GrB_INT8 , GrB_INT8 , "LG_SE_add_term " , ADD_TERM
538538 )) ;
539539
540540 GRB_TRY (GxB_Monoid_terminal_new_INT8 (
541541 & add_term_monoid , add_term_biop , (int8_t ) 0 , (int8_t ) 2
542542 )) ;
543543
544- edge_type64 iden_second = {0 ,0 };
544+ LG_SE_edge_type64 iden_second = {0 ,0 };
545545 GRB_TRY (GrB_Monoid_new_UDT (
546546 & second_edge_monoid , second_edge , (void * ) & iden_second
547547 )) ;
0 commit comments