Re: [eigen] Complex number divided by real |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Complex number divided by real
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 21 Jul 2010 23:52:11 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=BlK46xNHoCINzPDS9q29TlsdhJqyXLKb6zKrNIlLeb4=; b=KU4KnX4XXdQAgrX97pHSrAC5Y0r09cLUTEXklg09qiG/lqbDwd5Kiybcrpa83kozZu uvQIv0a+JFgzePMq5Hd9DnbEWXDgfnczQmtoXpZk15YZ1RgmHc64Nca4ncWq84d1A/FS CVNaPHuMWEQiA8fR5sKmqrfX6fj9/79niXCr4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=MaOUTeXP53PC9+9uzXJdHoNPzGtPv/jRMXLMKUxCxxzBafzb1WUxbSX7ER1+7mhRiG GfEeKCDjiy3FHS2FrG/EXJe+gAu4UlYQw9YVJmAWEpkwpaOud+3TY2wewasavakBuN3q aZmsWyQKMTnEufJwTgwAm1ZWFARy7aA09XoVY=
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