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

Baker, Christopher G. bakercg at ornl.gov
Wed Mar 3 09:15:25 MST 2010


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





More information about the Trilinos-Users mailing list