Skip to content

Fix a bug with MATHYPRE + COO + repeated MatSetValuesCOO(.., ADD_VALUES)

Junchao Zhang requested to merge jczhang/fix-MatHypre-COO-addvalues-twice into release

"MATHYPRE + COO" uses an agent matrix of type MATAIJ, which shares the data array with the MATHYPRE.

MATHYPRE stores the diagonal entries at front while MATAIJ does not.

Previously, AFTER MatSetValuesCOO(), we swap entries of MATAIJ on each row to match MATHYPRE.

With repeated MatSetValuesCOO(.., ADD_VALUES), we also need to swap the entries back (from MATHYPRE format to MATAIJ format) BEFORE MatSetValuesCOO() so that values could be added to their correct destination.

The swap operation is cheap (for each row, swap two entries), so we don't care much about its cost.

Edited by Junchao Zhang

Merge request reports