@@ -67,8 +67,14 @@ static GrB_Info LAGraph_RpqMatrixLor(RpqMatrixPlan *plan, char *msg)
67
67
GrB_Matrix lhs_mat = lhs -> res_mat ;
68
68
GrB_Matrix rhs_mat = rhs -> res_mat ;
69
69
70
- GRB_TRY (GrB_eWiseAdd (plan -> res_mat , GrB_NULL , GrB_NULL ,
71
- op , lhs_mat , rhs_mat , GrB_DESC_R ));
70
+ GrB_Index width , height ;
71
+ GrB_Matrix_nrows (& height , rhs_mat );
72
+ GrB_Matrix_ncols (& width , lhs_mat );
73
+ GrB_Matrix res ;
74
+ GrB_Matrix_new (& res , GrB_BOOL , height , width );
75
+ GRB_TRY (GrB_eWiseAdd (res , GrB_NULL , GrB_NULL ,
76
+ GrB_LOR , lhs_mat , rhs_mat , GrB_DESC_R ));
77
+ plan -> res_mat = res ;
72
78
73
79
return (GrB_SUCCESS );
74
80
}
@@ -83,11 +89,6 @@ static GrB_Info LAGraph_RpqMatrixConcat(RpqMatrixPlan *plan, char *msg)
83
89
RpqMatrixPlan * lhs = plan -> lhs ;
84
90
RpqMatrixPlan * rhs = plan -> rhs ;
85
91
86
- GrB_Index nvalsA , nvalsB ;
87
- GrB_Matrix_nvals (& nvalsA , lhs -> mat );
88
- GrB_Matrix_nvals (& nvalsB , rhs -> mat );
89
- fprintf (stderr , "\nDEBUG: A:%lu and B:%lu in Concat\n" , nvalsA , nvalsB );
90
-
91
92
LG_ASSERT (lhs != NULL , GrB_NULL_POINTER );
92
93
LG_ASSERT (rhs != NULL , GrB_NULL_POINTER );
93
94
@@ -97,22 +98,15 @@ static GrB_Info LAGraph_RpqMatrixConcat(RpqMatrixPlan *plan, char *msg)
97
98
GrB_Matrix lhs_mat = lhs -> res_mat ;
98
99
GrB_Matrix rhs_mat = rhs -> res_mat ;
99
100
100
- GrB_Matrix_nvals (& nvalsA , lhs_mat );
101
- GrB_Matrix_nvals (& nvalsB , rhs_mat );
102
- fprintf (stderr , "\nDEBUG: A:%lu and B:%lu in Concat after traversal\n" , nvalsA , nvalsB );
103
- fprintf (stderr , "\nDEBUG: before mxm\n" );
104
-
105
101
GrB_Index width , height ;
106
102
GrB_Matrix_nrows (& height , rhs_mat );
107
103
GrB_Matrix_ncols (& width , lhs_mat );
108
104
GrB_Matrix res ;
109
105
GrB_Matrix_new (& res , GrB_BOOL , height , width );
110
106
GRB_TRY (GrB_mxm (res , GrB_NULL , GrB_NULL ,
111
- sr , lhs_mat , rhs_mat , GrB_DESC_R ));
107
+ GrB_LOR_LAND_SEMIRING_BOOL , lhs_mat , rhs_mat , GrB_DESC_R ));
112
108
// GrB_mxm(plan->res_mat, GrB_NULL, GrB_NULL, GrB_LOR_LAND_SEMIRING_BOOL, lhs_mat, rhs_mat, GrB_NULL);
113
109
plan -> res_mat = res ;
114
- GrB_Matrix_nvals (& nvalsA , plan -> res_mat );
115
- fprintf (stderr , "\nDEBUG: A:%lu after mxm in Concat\n" , nvalsA );
116
110
117
111
return (GrB_SUCCESS );
118
112
}
@@ -152,19 +146,20 @@ static GrB_Info LAGraph_RpqMatrixKleene(RpqMatrixPlan *plan, char *msg)
152
146
GrB_Matrix BPE ;
153
147
GRB_TRY (GrB_Matrix_new (& BPE , GrB_BOOL , n , n ));
154
148
GRB_TRY (GrB_eWiseAdd (BPE , GrB_NULL , GrB_NULL ,
155
- op , B , E , GrB_DESC_R ));
149
+ GrB_LOR , B , E , GrB_DESC_R ));
156
150
// S <- S x (B + E)
157
151
GrB_Matrix S , T ;
158
152
GRB_TRY (GrB_Matrix_dup (& S , E ));
159
153
160
154
bool changed = true;
161
155
GrB_Index nnz_S = n , nnz_T = 0 ;
156
+
162
157
while (changed )
163
158
{
164
159
// T = S * (B + E)
165
160
GRB_TRY (GrB_Matrix_new (& T , GrB_BOOL , n , n ));
166
161
GRB_TRY (GrB_mxm (T , GrB_NULL , GrB_NULL ,
167
- sr , S , BPE , GrB_DESC_R ));
162
+ GrB_LOR_LAND_SEMIRING_BOOL , S , BPE , GrB_DESC_R ));
168
163
169
164
GRB_TRY (GrB_Matrix_nvals (& nnz_T , T ));
170
165
if (nnz_T != nnz_S )
@@ -191,19 +186,13 @@ GrB_Info LAGraph_RPQMatrix(RpqMatrixPlan *plan, char *msg)
191
186
{
192
187
if (plan -> res_mat != NULL )
193
188
{
194
- GrB_Index result ;
195
- GrB_Matrix_nvals (& result , plan -> res_mat );
196
- fprintf (stderr , "\nDEBUG: res_mat in LAGraph_RPQMatrix: %lu" , result );
197
189
return (GrB_SUCCESS );
198
190
}
199
191
200
192
switch (plan -> op )
201
193
{
202
194
case RPQ_MATRIX_OP_LABEL :
203
195
LG_ASSERT (plan -> lhs == NULL && plan -> rhs == NULL , GrB_INVALID_VALUE );
204
- GrB_Index result ;
205
- GrB_Matrix_nvals (& result , plan -> mat );
206
- fprintf (stderr , "\nDEBUG: res_mat in LAGraph_RPQMatrix switch: %lu" , result );
207
196
plan -> res_mat = plan -> mat ;
208
197
return (GrB_SUCCESS );
209
198
case RPQ_MATRIX_OP_LOR :
@@ -215,14 +204,11 @@ GrB_Info LAGraph_RPQMatrix(RpqMatrixPlan *plan, char *msg)
215
204
default :
216
205
LG_ASSERT (false, GrB_INVALID_VALUE );
217
206
}
218
- GrB_Index result ;
219
- GrB_Matrix_nvals (& result , plan -> res_mat );
220
- fprintf (stderr , "\nDEBUG: res_mat in LAGraph_RPQMatrix end: %lu" , result );
221
207
return (GrB_SUCCESS );
222
208
}
223
209
224
210
GrB_Info LAGraph_RpqMatrix_initialize ()
225
211
{
226
- sr = LAGraph_any_one_bool ;
227
- op = GxB_ANY_BOOL_MONOID ;
212
+ sr = GrB_LOR_LAND_SEMIRING_BOOL ;
213
+ op = GrB_LOR ;
228
214
}
0 commit comments