<div dir="ltr"><div dir="ltr">On Tue, Jan 5, 2021 at 7:57 AM Roland Richter <<a href="mailto:roland.richter@ntnu.no">roland.richter@ntnu.no</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hei,<br>
<br>
I would like to scale a given matrix with a fixed scalar value, and<br>
therefore would like to use MatScale(). Nevertheless, I observed an<br>
interesting behavior depending on the size of the matrix, and currently<br>
I am not sure why.<br>
<br>
When running the attached code, I intend to divide all elements in the<br>
matrix by a constant factor of 10. If I have three or fewer rows and<br>
1024 columns, I get the expected result. If I have four or more rows<br>
(with the same number of columns), suddenly my scaling factor seems to<br>
be 0.01 instead of 0.1 for the PETSc-matrix. The armadillo-based matrix<br>
still behaves as expected.<br></blockquote><div><br></div><div>1) It looks like you assume the storage in your armadillo matrix is row major. I would be surprised if this was true.</div><div><br></div><div>2) I think it is unlikely that there is a problem with MatScale, so I would guess either you have a memory overwrite</div><div>or are misinterpreting your output. If you send something I can run, I will figure out which it is.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I currently do not understand that behavior, but do not see any problems<br>
with the code either. Are there any possible explanations for that behavior?<br>
<br>
Thank you very much,<br>
<br>
regards,<br>
<br>
Roland Richter<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>