Re: [eigen] Complex number divided by real

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


for the record, let me just paste what I've replied on IRC:

[19:34] <ggael> artz: currently yes you have to do the cast but for
beta2 this will work just fine doing a complex/real division.
[19:34] <ggael> hm, actually the following should work too:
[19:35] <ggael> (complex array) * (real array).inverse()
[19:35] <ggael> the trick is that operator* already works for mixed
complex*real coefficient-wise product

gael.

On Wed, Jul 21, 2010 at 7:33 PM, Carlos Becker <carlosbecker@xxxxxxxxx> 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. The
> problem is that (according to what I see) a.array().abs() returns a real
> vector rather than a complex one. So I can fix that by casting to
> std::complex<float> but that would incurr in a performance loss right?
> I could normalize each value and then multiply, but I would have two
> divisions, and I don't even know if this 'element' normalization is possible
> with Eigen in its current state.
> I know there are changes being done to the complex part so I guess this is a
> good point to ask about this. Maybe supporting complex divided by real would
> be good for certain operations. I could also save it to a complex and then
> take the result as a real vector that is twice the size of the complex ones
> but I guess that it would be a performance loss since there would be many
> unnecessary accesses to memory.
> Thanks,
> Carlos



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