Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#154 Wrong result of outer_product() of complex vectors

release_3.8.x
closed
5
2012-09-15
2007-05-29
Adam Piątyszek
No

By: Yngve Selén (yngveselen) - 2007-05-28 13:41

It seems like the function outer_product does not work according to the convention for complex vectors. I'd expect that outer_product(x,y) (where x and y are of the type cvec) would return
xy^H
(^H denoting Hermitian transpose). However, what you get instead get is
x
y^T
so you have to use outer_product(x,conj(y)) to get the "conventional" outer product of vectors. I haven't found this "bug" documented anywhere.

Discussion

  • Logged In: YES
    user_id=1004597
    Originator: YES

    This bug is now fixed in SVN.
    /ediap

     
  • Logged In: YES
    user_id=1004597
    Originator: YES

    Errata:
    The fix was reverted from the repository, since it brakes interface without notifying end users. We are working on a better solution for this issue.

     
  • Logged In: YES
    user_id=1004597
    Originator: YES

    Finally this problem was fixed as follows:
    1) In the current stable branch (3.10.x), we decided to only update documentation and do not change the code at all, mainly for backward compatibility. So the outer_product() of complex vectors x, y results in (x * y^T). One can use outer_product(x, conj(y)) to perform (x * y^H) operation.
    2) In the development branch (3.99.x), an extra "hermitian" parameter has been added to this method:
    Mat<T> outer_product(const Vec<T> &v1, const Vec<T> &v2, bool hermitian = false);
    This parameter is ignored for vector types other than cvec. For complex vectors, a standard transposition of the second argument is performed by default for backward compatibility (hermitian = false). But one can explicitly choose a Hermitian transposition setting hermitian to true, e.g.:
    cmat M = outer_product(v1, v2, true); // (v1 * v2^H)