Re: [eigen] Inconsistency in multiplication of complex with real |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Inconsistency in multiplication of complex with real
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sat, 19 Jun 2010 16:46:02 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=T8/ODR6S4Ik7Guw8JHv8EU0hXFyT7RlcCkEk2U/fq/4=; b=gi360pTzMR6WBv7NSnxzzChMdF1jlTpfIFy2kJ8tUcckseTwW9Cu9yQb4BGFcPWo7g wdKaBoo/4FZyTCdompNWntzcQWcErM89ywejiM/Cr28zLCqFrFe/fTp4ZCfwdHYE0KSL UK+lBJBHAPqRubM3fhn6Zbzx+5c8u4iA+nQbk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=vSCzhTkrCiNCknrg+pVggiR6Z+3d5M5sRWvDKEhydpsoERuLrwh9iDbBzTKXIGe/I8 tcknLcv8QaS1IZ2urL0yFJ9wr8FU7H2+K2hnxKCFAbBKf5UT1ooE2m/VnrMw9r1QhvRm im5FFjV+jaEEJUOlYJC8A2Q1JVnwBrDzmX3hs=
oh, right!
2010/6/19 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
> well, there is a difference, for arrays operator * means coefficient
> wise product, while for matrices its the matrix product. Of course
> matrix product between real and complex should also be allowed, but
> implementation-wise this much more tricky....
>
> gael
>
> On Sat, Jun 19, 2010 at 10:26 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>> no good reason: Array vs Matrix shouldn't make any difference here.
>>
>> 2010/6/19 Manoj Rajagopalan <rmanoj@xxxxxxxxx>:
>>>
>>> Is there any reason why this type-promotion should work with Array but not
>>> Matrix? The short program below doesn't compile till I explicitly cast the
>>> MatrixXd to complex:
>>>
>>> int main(void)
>>> {
>>> int const N = 5;
>>> Eigen::MatrixXcd A(N,N);
>>> Eigen::MatrixXd B(N,N);
>>> Eigen::MatrixXcd C(N,N);
>>> A.setRandom();
>>> B.setRandom();
>>> C = A*B.cast<complex<double> >(); // compile fail without cast
>>> return 0;
>>> }
>>>
>>>
>>>
>>> Thanks,
>>> Manoj
>>>
>>>
>>>
>>> On Saturday 19 June 2010 01:06:59 pm Benoit Jacob wrote:
>>>> right, this is a bug, needs to be fixed.
>>>>
>>>> 2010/6/19 Johan Pauwels <johan.pauwels@xxxxxxxxxxxxx>:
>>>> > Hello all,
>>>> >
>>>> > I think I found a little inconsistency when multiplying a complex with a
>>>> > real array. See the snippet below
>>>> >
>>>> > #include <iostream>
>>>> > #include <Eigen/Core>
>>>> >
>>>> > int main()
>>>> > {
>>>> > Eigen::ArrayXcd complexArray = Eigen::ArrayXcd::Random(5);
>>>> > Eigen::ArrayXd realArray = Eigen::ArrayXd::Random(5);
>>>> > complexArray = complexArray * realArray;
>>>> > std::cout << complexArray << std::endl;
>>>> > complexArray *= realArray;
>>>> > std::cout << complexArray << std::endl;
>>>> > }
>>>> >
>>>> > The first multiplication just works, but the second causes
>>>> > 'YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MA
>>>> >TRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY' at compilation (Mac OS 10.6.3 -
>>>> > gcc 4.2.1, Eigen head). You would expect them to do the same, no?
>>>> >
>>>> > Regards,
>>>> > Johan
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>