[Trilinos-Users] Tpetra::dot for SCALAR=std::complex

Bartlett, Roscoe A rabartl at sandia.gov
Wed Mar 3 09:26:31 MST 2010


Chris,

You can add unit tests that ensure the correct behavior of dot products with complex numbers.  I have these in Thyra.

- Ross


> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-
> users-bounces at software.sandia.gov] On Behalf Of Baker, Christopher G.
> Sent: Wednesday, March 03, 2010 9:15 AM
> To: Nico Schlömer; trilinos-users at software.sandia.gov
> Subject: Re: [Trilinos-Users] Tpetra::dot for SCALAR=std::complex
> 
> Hi Nico,
> 
> I've found it. In fact, what the code is doing is
> \alpha = \Re( z_0^H z_1 ),
> This was probably a copy-paste error from the special-purpose single
> vector z0.dot(z0) case, where
> z_0^H z_0 = \Re( z_0^H z_0 )
> 
> It should be
> \alpha = z_0^H z_1
> where we no longer throw away the imaginary component.
> 
> I appreciate you tracking this down. I will verify, fix, and verify
> this right away in the dev and 10.0.x release branches.
> 
> Thanks again.
> Chris
> 
> 
> On 3/3/10 10:45 AM, "Nico Schlömer" <nico.schloemer at ua.ac.be> wrote:
> 
> Hi,
> 
> I'm calculating dot-products of Tpetra::Vectors with complex scalar
> types,
> and I was just trying to see whether Tpetra is smart enough to
> translate
> 
>     alpha = z0.dot( z1 ) // source code
> 
> into
> 
>     \alpha = z_0^H z_1 // maths
> 
> or whether it does
> 
>     \alpha = z_0^T z_1.
> 
> Well -- turns out it's neither of the two. Tpetra::dot apparently
> treats
> std::real(z0) and std::imag(z0) as separate vector components,
> calculates
> the |R-dot product of the 2*N vector, and effectively returns
> 
>     \alpha = \Re( z_0^T z_1 )
> 
> This is with the latest Git. A minimal example is attached to this
> mail.
> 
> Anyway, this is certainly not what I would expect a dot-product to do.
> I
> suggest that either the documentation is updated, or rather the code
> fixed.
> How about a test for this, too?
> 
> Cheers,
> Nico
> 
> 
> 
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users



More information about the Trilinos-Users mailing list