[petsc-users] a question about MatSetValue

Yang Bo (Asst Prof) yang.bo at ntu.edu.sg
Thu May 21 02:54:51 CDT 2020


Hi Everyone,

I have a question about adding values to the matrix. The code I have is


for (int i=0;i<row.size();i++) {
MatSetValue(A,row[i],column[i],h[i],INSERT_VALUES);
}

where row.size() is a large number. It seems the running time of this procedure does not scale linearly with row.size(). As row.size() gets bigger, the time it takes increases exponentially. Am I doing something wrong and can I do better than that?

Thanks and stay healthy!

Cheers,

Yang Bo
________________________________

CONFIDENTIALITY: This email is intended solely for the person(s) named and may be confidential and/or privileged. If you are not the intended recipient, please delete it, notify us and do not copy, use, or disclose its contents.
Towards a sustainable earth: Print only when necessary. Thank you.


More information about the petsc-users mailing list