[petsc-users] MatScale returns different results depending on matrix size

Roland Richter roland.richter at ntnu.no
Tue Jan 5 06:56:51 CST 2021


Hei,

I would like to scale a given matrix with a fixed scalar value, and
therefore would like to use MatScale(). Nevertheless, I observed an
interesting behavior depending on the size of the matrix, and currently
I am not sure why.

When running the attached code, I intend to divide all elements in the
matrix by a constant factor of 10. If I have three or fewer rows and
1024 columns, I get the expected result. If I have four or more rows
(with the same number of columns), suddenly my scaling factor seems to
be 0.01 instead of 0.1 for the PETSc-matrix. The armadillo-based matrix
still behaves as expected.

I currently do not understand that behavior, but do not see any problems
with the code either. Are there any possible explanations for that behavior?

Thank you very much,

regards,

Roland Richter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main_clean.cpp
Type: text/x-c++src
Size: 4155 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210105/4124ba08/attachment.bin>


More information about the petsc-users mailing list