On Tue, Jan 5, 2021 at 10:24 AM Roland Richter <[email protected]>
wrote:
> Hei,
>
> is there a function to square/cube etc. each element of a matrix or
> vector in PETSc? It is rather useful for things like intensity
> calculations (I = |E|^2), and should work also for distributed matrices.
>
We don't have that. We tend to shy away from functions in the interface,
since it makes cross-language
things hard. However,
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.
2) We could consider adding Vec/MatPointwiseFunction(A, f) where you apply
a function f pointwise to each entry.
Thanks,
Matt
> Thanks!
>
> Regards,
>
> Roland Richter
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>