@@ -151,7 +151,7 @@ typedef struct {
151
151
void matrix_update (Matrix * matrix ) {
152
152
GrB_Matrix_nvals (& matrix -> nvals , matrix -> base );
153
153
GrB_Matrix_nrows (& matrix -> size , matrix -> base );
154
- GrB_get (matrix -> base , & matrix -> format , GrB_STORAGE_ORIENTATION_HINT );
154
+ // GrB_get(matrix->base, &matrix->format, GrB_STORAGE_ORIENTATION_HINT);
155
155
}
156
156
157
157
Matrix matrix_from_base (GrB_Matrix matrix ) {
@@ -202,11 +202,15 @@ void matrix_to_format(Matrix *matrix, int32_t format, bool is_both) {
202
202
return ;
203
203
}
204
204
205
- GrB_Info matrix_clear (Matrix * A ) { return GrB_Matrix_clear (A -> base ); }
205
+ GrB_Info matrix_clear (Matrix * A ) {
206
+ GrB_Info result = GrB_Matrix_clear (A -> base );
207
+ matrix_update (A );
208
+ return result ;
209
+ }
206
210
207
211
GrB_Info matrix_clear_format (Matrix * A ) {
208
212
if (!A -> is_both ) {
209
- matrix_clear (A );
213
+ return matrix_clear (A );
210
214
}
211
215
212
216
matrix_to_format (A , GrB_ROWMAJOR , false);
@@ -229,8 +233,12 @@ GrB_Info matrix_clear_empty(Matrix *A) {
229
233
}
230
234
231
235
GrB_Info matrix_dup (Matrix * output , Matrix * input ) {
232
- return GrB_Matrix_assign (output -> base , GrB_NULL , GrB_NULL , input -> base , GrB_ALL ,
233
- input -> size , GrB_ALL , input -> size , GrB_NULL );
236
+ GrB_Info result =
237
+ GrB_Matrix_assign (output -> base , GrB_NULL , GrB_NULL , input -> base , GrB_ALL ,
238
+ input -> size , GrB_ALL , input -> size , GrB_NULL );
239
+
240
+ matrix_update (output );
241
+ return result ;
234
242
}
235
243
236
244
GrB_Info matrix_dup_format (Matrix * output , Matrix * input ) {
@@ -266,6 +274,7 @@ GrB_Info matrix_mxm(Matrix *output, Matrix *first, Matrix *second, bool accum) {
266
274
GrB_Info result = GrB_mxm (output -> base , GrB_NULL , accum ? GxB_ANY_BOOL : GrB_NULL ,
267
275
GxB_ANY_PAIR_BOOL , first -> base , second -> base , GrB_NULL );
268
276
IS_ISO (output -> base , "MXM output" );
277
+ matrix_update (output );
269
278
return result ;
270
279
}
271
280
@@ -324,8 +333,11 @@ GrB_Info matrix_rmxm_empty(Matrix *output, Matrix *first, Matrix *second, bool a
324
333
GrB_Info matrix_wise (Matrix * output , Matrix * first , Matrix * second , bool accum ) {
325
334
GrB_BinaryOp accum_op = accum ? GxB_ANY_BOOL : GrB_NULL ;
326
335
327
- return GrB_eWiseAdd (output -> base , GrB_NULL , accum_op , GxB_ANY_BOOL , first -> base ,
328
- second -> base , GrB_NULL );
336
+ GrB_Info result = GrB_eWiseAdd (output -> base , GrB_NULL , accum_op , GxB_ANY_BOOL ,
337
+ first -> base , second -> base , GrB_NULL );
338
+
339
+ matrix_update (output );
340
+ return result ;
329
341
}
330
342
331
343
GrB_Info matrix_wise_format (Matrix * output , Matrix * first , Matrix * second , bool accum ) {
@@ -384,8 +396,11 @@ GrB_Info matrix_wise_empty(Matrix *output, Matrix *first, Matrix *second, bool a
384
396
}
385
397
386
398
GrB_Info matrix_rsub (Matrix * output , Matrix * mask ) {
387
- return GrB_eWiseAdd (output -> base , mask -> base , GrB_NULL , GxB_ANY_BOOL , output -> base ,
388
- output -> base , GrB_DESC_RSC );
399
+ GrB_Info result = GrB_eWiseAdd (output -> base , mask -> base , GrB_NULL , GxB_ANY_BOOL ,
400
+ output -> base , output -> base , GrB_DESC_RSC );
401
+
402
+ matrix_update (output );
403
+ return result ;
389
404
}
390
405
391
406
GrB_Info matrix_rsub_format (Matrix * output , Matrix * mask ) {
@@ -698,7 +713,6 @@ GrB_Info LAGraph_CFL_reachability_adv(
698
713
699
714
for (int32_t i = 0 ; i < nonterms_count ; i ++ ) {
700
715
GRB_TRY (matrix_clear_empty (& temp_matrices [i ]));
701
- matrix_update (& temp_matrices [i ]);
702
716
}
703
717
704
718
TIMER_START ();
@@ -707,14 +721,12 @@ GrB_Info LAGraph_CFL_reachability_adv(
707
721
708
722
matrix_mxm_empty (& temp_matrices [bin_rule .nonterm ], & matrices [bin_rule .prod_A ],
709
723
& delta_matrices [bin_rule .prod_B ], false);
710
- matrix_update (& temp_matrices [bin_rule .nonterm ]);
711
724
}
712
725
TIMER_STOP ("MXM 1" , & mxm1 );
713
726
714
727
TIMER_START ()
715
728
for (int32_t i = 0 ; i < nonterms_count ; i ++ ) {
716
729
matrix_wise_empty (& matrices [i ], & matrices [i ], & delta_matrices [i ], false);
717
- matrix_update (& matrices [i ]);
718
730
}
719
731
TIMER_STOP ("WISE 1" , & wise1 );
720
732
@@ -725,7 +737,6 @@ GrB_Info LAGraph_CFL_reachability_adv(
725
737
matrix_rmxm_empty (& temp_matrices [bin_rule .nonterm ],
726
738
& delta_matrices [bin_rule .prod_A ],
727
739
& matrices [bin_rule .prod_B ], true);
728
- matrix_update (& temp_matrices [bin_rule .nonterm ]);
729
740
}
730
741
TIMER_STOP ("MXM 2" , & mxm2 );
731
742
@@ -738,7 +749,6 @@ GrB_Info LAGraph_CFL_reachability_adv(
738
749
TIMER_START ();
739
750
for (int32_t i = 0 ; i < nonterms_count ; i ++ ) {
740
751
matrix_rsub_empty (& delta_matrices [i ], & matrices [i ]);
741
- matrix_update (& delta_matrices [i ]);
742
752
}
743
753
TIMER_STOP ("WISE 3 (MASK)" , & rsub );
744
754
0 commit comments