@@ -235,6 +235,11 @@ GrB_Info matrix_dup(Matrix *output, Matrix *input) {
235
235
236
236
GrB_Info matrix_dup_format (Matrix * output , Matrix * input ) {
237
237
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
+
238
243
return matrix_dup (output , input );
239
244
}
240
245
@@ -325,17 +330,28 @@ GrB_Info matrix_wise(Matrix *output, Matrix *first, Matrix *second, bool accum)
325
330
326
331
GrB_Info matrix_wise_format (Matrix * output , Matrix * first , Matrix * second , bool accum ) {
327
332
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
+
328
340
return matrix_wise (output , first , second , accum );
329
341
}
330
342
331
343
matrix_to_format (output , GrB_ROWMAJOR , false);
344
+ matrix_to_format (first , output -> format , false);
345
+ matrix_to_format (second , output -> format , false);
332
346
GrB_Info result = matrix_wise (output , first , second , accum );
333
347
334
348
if (result < GrB_SUCCESS ) {
335
349
return result ;
336
350
}
337
351
338
352
matrix_to_format (output , GrB_COLMAJOR , false);
353
+ matrix_to_format (first , output -> format , false);
354
+ matrix_to_format (second , output -> format , false);
339
355
return matrix_wise (output , first , second , accum );
340
356
}
341
357
0 commit comments