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

Matthew Knepley knepley at gmail.com
Tue Jan 5 09:42:27 CST 2021


On Tue, Jan 5, 2021 at 10:41 AM Roland Richter <roland.richter at ntnu.no>
wrote:

> 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?
>
> While most foreign function interfaces can handle basic types, there is no
standard for function types.

  Thanks,

     Matt

> 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>
> 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/>
>
>

-- 
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/817700b9/attachment.html>


More information about the petsc-users mailing list