[petsc-dev] various dot products messed up for complex numbers?
Barry Smith
bsmith at mcs.anl.gov
Sun Apr 15 13:32:38 CDT 2012
On Apr 15, 2012, at 1:09 PM, Jed Brown wrote:
> On Sun, Apr 15, 2012 at 12:55, Barry Smith <bsmith at mcs.anl.gov> wrote:
> Real mathematicians conjugate the second one :-)
>
> I never unrderstood that choice. I like vectors to be column vectors, one forms to be row vectors, and operations to have standard fixity. How some mathematicians ended up with infix operators and postfix inner products is beyond me.
I checked a couple of analysis books I have at home and they all conjugate the second argument.
For inner products over a real field one has
(x,y) = (y,x)
(x+w,y) = (x,y) + (w,y)
(ax,y) = a(x,y)
(x,x) \ge 0
(x,x) = 0 only if x = 0
Now extend to complex fields, if the only change you make is
(x,y) = complex conjugate ((y,x)) but keep everything else the same then the conjugate has to be done on the second argument. If you did it on the first you would get (ax,y) = conjugate(a) (x,y).
Of course this is arbitrary and it would be fine to also change the (ax,y) = a(x,y) to conjugate(a) (x,y). but it just isn't done :-)
Barry
>
>
> The code to check is PETSc's conjugate gradient, there the conjugate does mater :-).
>
> Looks right to me.
>
> ierr = KSP_MatMult(ksp,Amat,P,W);CHKERRQ(ierr); /* w <- Ap */
> ierr = VecXDot(P,W,&dpi);CHKERRQ(ierr); /* dpi <- p'w */
>
More information about the petsc-dev
mailing list