[petsc-users] vec norm for local portion of a vector
Barry Smith
bsmith at mcs.anl.gov
Tue Aug 2 04:20:48 CDT 2016
You are correct, I was wrong. It returns the 2 norm (not the square of the 2 norm).
Barry
> On Aug 1, 2016, at 2:59 PM, Xiangdong <epscodes at gmail.com> wrote:
>
>
>
> On Fri, Jul 29, 2016 at 10:41 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> > On Jul 27, 2016, at 4:42 PM, Xiangdong <epscodes at gmail.com> wrote:
> >
> > Hello everyone,
> >
> > I have a global dmda vector vg. On each processor, if I want to know the norm of local portion of vg, which function should I call?
> >
> > So far I am thinking of using DMDAVecGetArray and then write a loop to compute the norm of this local array.
> >
> > Is there a simple function available to call? like *vg->ops->norm_local(vg,NORM_2, &normlocal)?
>
> There isn't a public interface to this call because it really isn't a mathematically well defined object; the subdomains in the decomposition of the array are arbitrary based on the number of processes used.
>
> Anyways if you want it and it is the NON-overlapping portion then yes, you can write a little routine (basically just cut and paste VecNorm()) call it say VecNormLocal() and have it call the function pointer you indicated above. Note for the 2 norm the norm_local() returns the square of the norm so you need to take the square root.
>
> I am interested in this non-overlapping case. I found that this norm_local() function returns the correct l2 norm, not the square of norm. I am using old version 3.5. Are there changes in recent version such that norm_local() returns the square of the norm?
>
> Xiangdong
>
>
> If you want the overlapping portion of the vector then you should just do the DMDAVecGetArray() as you already do.
>
> Barry
>
>
>
> >
> > Thanks.
> >
> > Best,
> > Xiangdong
> >
More information about the petsc-users
mailing list