Re: [eigen] Complex number divided by real

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On Thu, Jul 22, 2010 at 12:17 AM, Christoph Hertzberg
<chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Carlos Becker wrote:
>>
>> Hi everyone,
>> (first, I am using the dev branch)
>>
>> I am trying to do something like (a.array() * b.array().conjugate()) / (
>> a.array().abs() * b.array().abs() ), where a and b are two VectorXcf.
>
> Wouldn't something like this work in your case? (I didn't actually try it
> ...)
>
> (a.array() * b.array().conjugate()).rowwise().normalized();

there is no such vectorwise normalized() function yet, but it could be
added I guess.

Now to answer new related Carlos's trouble:

[23:56] <artz> I was trying something different now and doesn't seem to work
[23:57] <artz> like this: VectorXf a; VectorXcf b,c;  c = b.array() *
a.array().inverse()
[23:57] <artz> should it work?

Yes it should ;) With default branch it indeed fails to compile, with
my "complex" fork it does work fine.

Actually I'm tempted to do the merge today since here all tests
succeed with gcc on both a 64 and 32 bit systems...

gael

>
> Because:
> abs(a)*abs(b) = abs(a)*abs(conj(b)) = abs(a*conj(b))
>
> Actually, an elementwise signum function would be helpful in that case.
>
>
>
> --
> ----------------------------------------------
> Dipl.-Inf. Christoph Hertzberg
> Cartesium 0.051
> Universität Bremen
> Enrique-Schmidt-Straße 5
> 28359 Bremen
>
> Tel: (+49) 421-218-64252
> ----------------------------------------------
>
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/