Skip to content

Commit 3abde77

Browse files
committed
Feat: manually choose format in wise and dup method
1 parent 7140270 commit 3abde77

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

experimental/algorithm/LAGraph_CFL_reachability_advanced.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ GrB_Info matrix_dup(Matrix *output, Matrix *input) {
235235

236236
GrB_Info matrix_dup_format(Matrix *output, Matrix *input) {
237237
if (!output->is_both) {
238+
Matrix *larger = output->nvals > input->nvals ? output : input;
239+
240+
matrix_to_format(output, larger->format, false);
241+
matrix_to_format(input, larger->format, false);
242+
238243
return matrix_dup(output, input);
239244
}
240245

@@ -325,17 +330,28 @@ GrB_Info matrix_wise(Matrix *output, Matrix *first, Matrix *second, bool accum)
325330

326331
GrB_Info matrix_wise_format(Matrix *output, Matrix *first, Matrix *second, bool accum) {
327332
if (!output->is_both) {
333+
Matrix *larger = output->nvals > first->nvals ? output : first;
334+
larger = larger->nvals > second->nvals ? larger : second;
335+
336+
matrix_to_format(output, larger->format, false);
337+
matrix_to_format(first, larger->format, false);
338+
matrix_to_format(second, larger->format, false);
339+
328340
return matrix_wise(output, first, second, accum);
329341
}
330342

331343
matrix_to_format(output, GrB_ROWMAJOR, false);
344+
matrix_to_format(first, output->format, false);
345+
matrix_to_format(second, output->format, false);
332346
GrB_Info result = matrix_wise(output, first, second, accum);
333347

334348
if (result < GrB_SUCCESS) {
335349
return result;
336350
}
337351

338352
matrix_to_format(output, GrB_COLMAJOR, false);
353+
matrix_to_format(first, output->format, false);
354+
matrix_to_format(second, output->format, false);
339355
return matrix_wise(output, first, second, accum);
340356
}
341357

0 commit comments

Comments
 (0)