[petsc-users] Elementwise pow/exponential-function on PETSc-vectors and matrices

Roland Richter roland.richter at ntnu.no
Tue Jan 5 09:41:31 CST 2021


Hei,

thanks for the offer! Both options would be a possibility. Option one
would be more specific, but I could imagine that implementing it using
SSE/AVX-functions should be easier for better throughput. Option two
would definitely be more flexible, but might loose the advantage of
being able to use SSE/AVX functions. Or do you rely on higher-level
commands for such constructions?

By the way, why would that make cross-language things harder?

Thanks,

regards,

Roland

Am 05.01.21 um 16:34 schrieb Matthew Knepley:
> On Tue, Jan 5, 2021 at 10:24 AM Roland Richter <roland.richter at ntnu.no
> <mailto:roland.richter at ntnu.no>> 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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210105/1aa5f7ee/attachment.html>


More information about the petsc-users mailing list