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 <[email protected] > <mailto:[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/>
