<div dir="ltr"><div dir="ltr">On Tue, Jan 5, 2021 at 10:24 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>
is there a function to square/cube etc. each element of a matrix or<br>
vector in PETSc? It is rather useful for things like intensity<br>
calculations (I = |E|^2), and should work also for distributed matrices.<br></blockquote><div><br></div><div>We don't have that. We tend to shy away from functions in the interface, since it makes cross-language</div><div>things hard. However,</div><div><br></div><div>1) I would be willing to add functions that you want, like square or cube, if you think it will make things easier for you.</div><div><br></div><div>2) We could consider adding Vec/MatPointwiseFunction(A, f) where you apply a function f pointwise to each entry.</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">
Thanks!<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>