Skip to content

Commit 5e9cc46

Browse files
Merge pull request #370 from GraphBLAS/with_GraphBLAS_v10
rename user-defined types and operators in LAGraph, to guard against name collisions
2 parents 65480de + fb3e6f1 commit 5e9cc46

15 files changed

+985
-653
lines changed

experimental/algorithm/LAGr_EdgeBetweennessCentrality.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@
6666
// (1+x)/y function for double: z = (1 + x) / y
6767
//------------------------------------------------------------------------------
6868

69-
void add_one_divide_function (double *z, const double *x, const double *y)
69+
void LG_EBC_add_one_divide_function (double *z, const double *x, const double *y)
7070
{
7171
double a = (*(x)) ;
7272
double b = (*(y)) ;
7373
(*(z)) = (1 + a) / b ;
7474
}
7575

7676
#define ADD_ONE_DIVIDE_FUNCTION_DEFN \
77-
"void add_one_divide_function (double *z, const double *x, const double *y)\n" \
77+
"void LG_EBC_add_one_divide_function (double *z, const double *x, const double *y)\n" \
7878
"{ \n" \
7979
" double a = (*(x)) ; \n" \
8080
" double b = (*(y)) ; \n" \
@@ -203,9 +203,9 @@ int LAGr_EdgeBetweennessCentrality
203203
// =========================================================================
204204

205205
GRB_TRY (GxB_BinaryOp_new (&Add_One_Divide,
206-
(GxB_binary_function) add_one_divide_function,
206+
(GxB_binary_function) LG_EBC_add_one_divide_function,
207207
GrB_FP64, GrB_FP64, GrB_FP64,
208-
"add_one_divide_function", ADD_ONE_DIVIDE_FUNCTION_DEFN)) ;
208+
"LG_EBC_add_one_divide_function", ADD_ONE_DIVIDE_FUNCTION_DEFN)) ;
209209

210210
// Initialize the frontier, paths, Update, and bc_vertex_flow
211211
GRB_TRY (GrB_Vector_new (&paths, GrB_FP64, n)) ;

experimental/algorithm/LAGr_MaxFlow.c

Lines changed: 133 additions & 133 deletions
Large diffs are not rendered by default.

experimental/algorithm/LAGr_MaximumMatching.c

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -46,114 +46,114 @@ typedef struct
4646
{
4747
uint64_t parentC;
4848
uint64_t rootC;
49-
} vertex;
49+
} LG_MM_vertex;
5050

5151
// repeat the typedef as a string, to give to GraphBLAS
5252
#define VERTEX_DEFN \
5353
"typedef struct \n" \
5454
"{ \n" \
5555
" uint64_t parentC; \n" \
5656
" uint64_t rootC; \n" \
57-
"} vertex;"
57+
"} LG_MM_vertex;"
5858

59-
void initFrontier(vertex *z, const bool *x, uint64_t i, uint64_t j, const bool *y)
59+
void LG_MM_initFrontier(LG_MM_vertex *z, const bool *x, uint64_t i, uint64_t j, const bool *y)
6060
{
6161
z->parentC = i;
6262
z->rootC = i;
6363
}
6464

6565
#define INIT_FRONTIER_DEFN \
66-
"void initFrontier(vertex *z, const bool *x, uint64_t i, uint64_t j, const bool *y) \n" \
66+
"void LG_MM_initFrontier(LG_MM_vertex *z, const bool *x, uint64_t i, uint64_t j, const bool *y) \n" \
6767
"{ \n" \
6868
" z->parentC = i; \n" \
6969
" z->rootC = i; \n" \
7070
"}"
7171

72-
void minparent(vertex *z, const vertex *x, const vertex *y)
72+
void LG_MM_minparent(LG_MM_vertex *z, const LG_MM_vertex *x, const LG_MM_vertex *y)
7373
{
7474
*z = x->parentC < y->parentC ? *x : *y;
7575
}
7676

7777
#define MIN_PARENT_DEFN \
78-
"void minparent(vertex *z, const vertex *x, const vertex *y) \n" \
78+
"void LG_MM_minparent(LG_MM_vertex *z, const LG_MM_vertex *x, const LG_MM_vertex *y) \n" \
7979
"{ \n" \
8080
" *z = x->parentC < y->parentC ? *x : *y; \n" \
8181
"}"
8282

83-
// TODO: revise GraphBLAS so we can tell it that the select2nd operator
83+
// TODO: revise GraphBLAS so we can tell it that the LG_MM_select2nd operator
8484
// does not use the 'x' input.
85-
void select2nd(vertex *z, const bool *x, const vertex *y)
85+
void LG_MM_select2nd(LG_MM_vertex *z, const bool *x, const LG_MM_vertex *y)
8686
{
8787
z->parentC = y->parentC;
8888
z->rootC = y->rootC;
8989
}
9090

9191
#define SELECT_2ND_DEFN \
92-
"void select2nd(vertex *z, const bool *x, const vertex *y) \n" \
92+
"void LG_MM_select2nd(LG_MM_vertex *z, const bool *x, const LG_MM_vertex *y) \n" \
9393
"{ \n" \
9494
" z->parentC = y->parentC; \n" \
9595
" z->rootC = y->rootC; \n" \
9696
"}"
9797

98-
void select1st(vertex *z, const vertex *x, const bool *y)
98+
void LG_MM_select1st(LG_MM_vertex *z, const LG_MM_vertex *x, const bool *y)
9999
{
100100
z->parentC = x->parentC;
101101
z->rootC = x->rootC;
102102
}
103103

104104
#define SELECT_1ST_DEFN \
105-
"void select1st(vertex *z, const vertex *x, const bool *y) \n" \
105+
"void LG_MM_select1st(LG_MM_vertex *z, const LG_MM_vertex *x, const bool *y) \n" \
106106
"{ \n" \
107107
" z->parentC = x->parentC; \n" \
108108
" z->rootC = x->rootC; \n" \
109109
"}"
110110

111-
void keepParents(uint64_t *z, const vertex *x) { *z = x->parentC; }
111+
void LG_MM_keepParents(uint64_t *z, const LG_MM_vertex *x) { *z = x->parentC; }
112112

113113
#define KEEP_PARENTS_DEFN \
114-
"void keepParents(uint64_t *z, const vertex *x) { *z = x->parentC; }\n"
114+
"void LG_MM_keepParents(uint64_t *z, const LG_MM_vertex *x) { *z = x->parentC; }\n"
115115

116-
void keepRoots(uint64_t *z, const vertex *x) { *z = x->rootC; }
116+
void LG_MM_keepRoots(uint64_t *z, const LG_MM_vertex *x) { *z = x->rootC; }
117117

118118
#define KEEP_ROOTS_DEFN \
119-
"void keepRoots(uint64_t *z, const vertex *x) { *z = x->rootC; }\n"
119+
"void LG_MM_keepRoots(uint64_t *z, const LG_MM_vertex *x) { *z = x->rootC; }\n"
120120

121-
void buildfCTuples(vertex *z, const uint64_t *x, uint64_t i, uint64_t j,
121+
void LG_MM_buildfCTuples(LG_MM_vertex *z, const uint64_t *x, uint64_t i, uint64_t j,
122122
const bool *y)
123123
{
124124
z->parentC = i;
125125
z->rootC = *x;
126126
}
127127

128128
#define BUILT_FC_TUPLES_DEFN \
129-
"void buildfCTuples(vertex *z, const uint64_t *x, uint64_t i, uint64_t j, \n" \
129+
"void LG_MM_buildfCTuples(LG_MM_vertex *z, const uint64_t *x, uint64_t i, uint64_t j, \n" \
130130
" const bool *y) \n" \
131131
"{ \n" \
132132
" z->parentC = i; \n" \
133133
" z->rootC = *x; \n" \
134134
"}"
135135

136-
void vertexTypecast(vertex *z, const uint64_t *x)
136+
void LG_MM_vertexTypecast(LG_MM_vertex *z, const uint64_t *x)
137137
{
138138
z->parentC = *x;
139139
z->rootC = *x;
140140
}
141141

142142
#define VERTEX_TYPECAST_DEFN \
143-
"void vertexTypecast(vertex *z, const uint64_t *x) \n" \
143+
"void LG_MM_vertexTypecast(LG_MM_vertex *z, const uint64_t *x) \n" \
144144
"{ \n" \
145145
" z->parentC = *x; \n" \
146146
" z->rootC = *x; \n" \
147147
"}"
148148

149-
void setParentsMates(vertex *z, const vertex *x, const vertex *y)
149+
void LG_MM_setParentsMates(LG_MM_vertex *z, const LG_MM_vertex *x, const LG_MM_vertex *y)
150150
{
151151
z->parentC = y->parentC;
152152
z->rootC = x->rootC;
153153
}
154154

155155
#define SET_PARENTS_MATES_DEFN \
156-
"void setParentsMates(vertex *z, const vertex *x, const vertex *y) \n" \
156+
"void LG_MM_setParentsMates(LG_MM_vertex *z, const LG_MM_vertex *x, const LG_MM_vertex *y) \n" \
157157
"{ \n" \
158158
" z->parentC = y->parentC; \n" \
159159
" z->rootC = x->rootC; \n" \
@@ -397,8 +397,8 @@ invert_2(GrB_Vector out, // input/output
397397
GRB_TRY(GrB_Vector_wait(in1, GrB_MATERIALIZE));
398398
if (udt)
399399
{
400-
vertex *X1_V = NULL;
401-
LG_TRY(LAGraph_Malloc((void **)&X1_V, nvals2, sizeof(vertex), msg));
400+
LG_MM_vertex *X1_V = NULL;
401+
LG_TRY(LAGraph_Malloc((void **)&X1_V, nvals2, sizeof(LG_MM_vertex), msg));
402402
for (uint64_t i = 0; i < nvals2; i++)
403403
{
404404
GRB_TRY(GrB_Vector_extractElement_UDT(
@@ -570,73 +570,73 @@ int LAGr_MaximumMatching(
570570
GRB_TRY(GrB_Vector_new(&parentsR, GrB_UINT64, nrows));
571571

572572
#if LAGRAPH_SUITESPARSE
573-
GRB_TRY(GxB_Type_new(&Vertex, sizeof(vertex), "vertex", VERTEX_DEFN));
573+
GRB_TRY(GxB_Type_new(&Vertex, sizeof(LG_MM_vertex), "LG_MM_vertex", VERTEX_DEFN));
574574
#else
575-
GRB_TRY(GrB_Type_new(&Vertex, sizeof(vertex)));
575+
GRB_TRY(GrB_Type_new(&Vertex, sizeof(LG_MM_vertex)));
576576
#endif
577577

578578
GRB_TRY(GrB_Vector_new(&frontierC, Vertex, ncols));
579579

580580
GRB_TRY(GrB_Vector_new(&frontierR, Vertex, nrows));
581581

582582
#if LAGRAPH_SUITESPARSE
583-
GRB_TRY(GxB_IndexUnaryOp_new(&initFrontierOp, (void *)initFrontier, Vertex,
584-
GrB_BOOL, GrB_BOOL, "initFrontier",
583+
GRB_TRY(GxB_IndexUnaryOp_new(&initFrontierOp, (void *)LG_MM_initFrontier, Vertex,
584+
GrB_BOOL, GrB_BOOL, "LG_MM_initFrontier",
585585
INIT_FRONTIER_DEFN));
586586
#else
587-
GRB_TRY(GrB_IndexUnaryOp_new(&initFrontierOp, (void *)initFrontier, Vertex,
587+
GRB_TRY(GrB_IndexUnaryOp_new(&initFrontierOp, (void *)LG_MM_initFrontier, Vertex,
588588
GrB_BOOL, GrB_BOOL));
589589
#endif
590590

591591
GRB_TRY(GrB_Vector_new(&I, GrB_BOOL, ncols));
592592
GRB_TRY(GrB_Vector_assign_BOOL(I, NULL, NULL, 1, GrB_ALL, ncols, NULL));
593593

594594
#if LAGRAPH_SUITESPARSE
595-
GRB_TRY(GxB_BinaryOp_new(&MinParent, (void *)minparent, Vertex, Vertex,
596-
Vertex, "minparent", MIN_PARENT_DEFN));
595+
GRB_TRY(GxB_BinaryOp_new(&MinParent, (void *)LG_MM_minparent, Vertex, Vertex,
596+
Vertex, "LG_MM_minparent", MIN_PARENT_DEFN));
597597
#else
598-
GRB_TRY(GrB_BinaryOp_new(&MinParent, (void *)minparent, Vertex, Vertex,
598+
GRB_TRY(GrB_BinaryOp_new(&MinParent, (void *)LG_MM_minparent, Vertex, Vertex,
599599
Vertex));
600600
#endif
601-
vertex infinityParent = {GrB_INDEX_MAX + 1, 0};
601+
LG_MM_vertex infinityParent = {GrB_INDEX_MAX + 1, 0};
602602
GRB_TRY(GrB_Monoid_new_UDT(&MinParent_Monoid, MinParent, &infinityParent));
603603

604604
#if LAGRAPH_SUITESPARSE
605-
GRB_TRY(GxB_BinaryOp_new(&Select2ndOp, (void *)select2nd, Vertex, GrB_BOOL,
606-
Vertex, "select2nd", SELECT_2ND_DEFN));
605+
GRB_TRY(GxB_BinaryOp_new(&Select2ndOp, (void *)LG_MM_select2nd, Vertex, GrB_BOOL,
606+
Vertex, "LG_MM_select2nd", SELECT_2ND_DEFN));
607607
#else
608-
GRB_TRY(GrB_BinaryOp_new(&Select2ndOp, (void *)select2nd, Vertex, GrB_BOOL,
608+
GRB_TRY(GrB_BinaryOp_new(&Select2ndOp, (void *)LG_MM_select2nd, Vertex, GrB_BOOL,
609609
Vertex));
610610
#endif
611611

612612
GRB_TRY(GrB_Semiring_new(&MinParent_2nd_Semiring, MinParent_Monoid,
613613
Select2ndOp));
614614

615615
#if LAGRAPH_SUITESPARSE
616-
GRB_TRY(GxB_BinaryOp_new(&Select1stOp, (void *)select1st, Vertex, Vertex,
617-
GrB_BOOL, "select1st", SELECT_1ST_DEFN));
616+
GRB_TRY(GxB_BinaryOp_new(&Select1stOp, (void *)LG_MM_select1st, Vertex, Vertex,
617+
GrB_BOOL, "LG_MM_select1st", SELECT_1ST_DEFN));
618618
#else
619-
GRB_TRY(GrB_BinaryOp_new(&Select1stOp, (void *)select1st, Vertex, Vertex,
619+
GRB_TRY(GrB_BinaryOp_new(&Select1stOp, (void *)LG_MM_select1st, Vertex, Vertex,
620620
GrB_BOOL));
621621
#endif
622622

623623
GRB_TRY(GrB_Semiring_new(&MinParent_1st_Semiring, MinParent_Monoid,
624624
Select1stOp));
625625

626626
#if LAGRAPH_SUITESPARSE
627-
GRB_TRY(GxB_UnaryOp_new(&getParentsOp, (void *)keepParents, GrB_UINT64,
628-
Vertex, "keepParents", KEEP_PARENTS_DEFN));
627+
GRB_TRY(GxB_UnaryOp_new(&getParentsOp, (void *)LG_MM_keepParents, GrB_UINT64,
628+
Vertex, "LG_MM_keepParents", KEEP_PARENTS_DEFN));
629629
#else
630-
GRB_TRY(GrB_UnaryOp_new(&getParentsOp, (void *)keepParents, GrB_UINT64,
630+
GRB_TRY(GrB_UnaryOp_new(&getParentsOp, (void *)LG_MM_keepParents, GrB_UINT64,
631631
Vertex));
632632
#endif
633633

634634
#if LAGRAPH_SUITESPARSE
635-
GRB_TRY(GxB_UnaryOp_new(&getRootsOp, (void *)keepRoots, GrB_UINT64, Vertex,
636-
"keepRoots", KEEP_ROOTS_DEFN));
635+
GRB_TRY(GxB_UnaryOp_new(&getRootsOp, (void *)LG_MM_keepRoots, GrB_UINT64, Vertex,
636+
"LG_MM_keepRoots", KEEP_ROOTS_DEFN));
637637
#else
638638
GRB_TRY(
639-
GrB_UnaryOp_new(&getRootsOp, (void *)keepRoots, GrB_UINT64, Vertex));
639+
GrB_UnaryOp_new(&getRootsOp, (void *)LG_MM_keepRoots, GrB_UINT64, Vertex));
640640
#endif
641641

642642
GRB_TRY(GrB_Vector_new(&parentsUpdate, GrB_UINT64, nrows));
@@ -654,29 +654,29 @@ int LAGr_MaximumMatching(
654654
GRB_TRY(GrB_Vector_new(&rootfRIndexes, GrB_UINT64, ncols));
655655

656656
#if LAGRAPH_SUITESPARSE
657-
GRB_TRY(GxB_IndexUnaryOp_new(&buildfCTuplesOp, (void *)buildfCTuples,
658-
Vertex, GrB_UINT64, GrB_BOOL, "buildfCTuples",
657+
GRB_TRY(GxB_IndexUnaryOp_new(&buildfCTuplesOp, (void *)LG_MM_buildfCTuples,
658+
Vertex, GrB_UINT64, GrB_BOOL, "LG_MM_buildfCTuples",
659659
BUILT_FC_TUPLES_DEFN));
660660
#else
661-
GRB_TRY(GrB_IndexUnaryOp_new(&buildfCTuplesOp, (void *)buildfCTuples,
661+
GRB_TRY(GrB_IndexUnaryOp_new(&buildfCTuplesOp, (void *)LG_MM_buildfCTuples,
662662
Vertex, GrB_UINT64, GrB_BOOL));
663663
#endif
664664

665665
#if LAGRAPH_SUITESPARSE
666-
GRB_TRY(GxB_UnaryOp_new(&vertexTypecastOp, (void *)vertexTypecast, Vertex,
667-
GrB_UINT64, "vertexTypecast",
666+
GRB_TRY(GxB_UnaryOp_new(&vertexTypecastOp, (void *)LG_MM_vertexTypecast, Vertex,
667+
GrB_UINT64, "LG_MM_vertexTypecast",
668668
VERTEX_TYPECAST_DEFN));
669669
#else
670-
GRB_TRY(GrB_UnaryOp_new(&vertexTypecastOp, (void *)vertexTypecast, Vertex,
670+
GRB_TRY(GrB_UnaryOp_new(&vertexTypecastOp, (void *)LG_MM_vertexTypecast, Vertex,
671671
GrB_UINT64));
672672
#endif
673673

674674
#if LAGRAPH_SUITESPARSE
675-
GRB_TRY(GxB_BinaryOp_new(&setParentsMatesOp, (void *)setParentsMates,
676-
Vertex, Vertex, Vertex, "setParentsMates",
675+
GRB_TRY(GxB_BinaryOp_new(&setParentsMatesOp, (void *)LG_MM_setParentsMates,
676+
Vertex, Vertex, Vertex, "LG_MM_setParentsMates",
677677
SET_PARENTS_MATES_DEFN));
678678
#else
679-
GRB_TRY(GrB_BinaryOp_new(&setParentsMatesOp, (void *)setParentsMates,
679+
GRB_TRY(GrB_BinaryOp_new(&setParentsMatesOp, (void *)LG_MM_setParentsMates,
680680
Vertex, Vertex, Vertex));
681681
#endif
682682

0 commit comments

Comments
 (0)