<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hei,</p>
<p>the code I attached to the original mail should work out of the
box, but requires armadillo and PETSc to compile/run. Armadillo
stores the data in column-major order, and therefore I am
transposing the matrices before and after transferring using
.st().</p>
<p>Thank you for your help!</p>
<p>Regards,</p>
<p>Roland<br>
</p>
<div class="moz-cite-prefix">Am 05.01.21 um 15:21 schrieb Matthew
Knepley:<br>
</div>
<blockquote type="cite"
cite="mid:CAMYG4Gmuc3GduTbT3zd4GShyMF0Yi57FEnDjwhE_sPUSU_9Vyg@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">On Tue, Jan 5, 2021 at 7:57 AM Roland Richter
<<a href="mailto:roland.richter@ntnu.no"
moz-do-not-send="true">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" moz-do-not-send="true">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</body>
</html>