Re: [eigen] Convert 1x1 matrix to internal type? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Convert 1x1 matrix to internal type?
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Thu, 23 Sep 2010 18:40:34 +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=Ls9rUCliQItf28kEOucdzRLsb8aUQa8VSRzDH53uVvw=; b=sf5ua/kFF/r4rRKtax+n4ffi1rFUfMnq9IdWWy3R7RcUiENPxj5ObKdt+1BYcR80qp W0GLrg44z82U4AhvXz/21sihmCskdtPRJPTTfMsNCdnajrK2weisdM9Dj/vdqSfwt1Us MlnGXBh0A05WCqxDRoFt5RlxjPDmOMX353u34=
- 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=tI/oEPibL6EFwNcRqD86CMI/EQPW45vFp7l/hpxhpD4PGtkGYaYMuOX0Uuj3sLH08m FkfS2Neh8H8nldCmSNw9RNjBiRLHu2ovuHm1dARBfqwy7l0tYL8/8l0V/dYqOOJV+TKS GW3TPVnkd8T7H+zKH8Sif3wuqxBA2vdojjeNw=
Hi all,
note that as explained here:
http://eigen.tuxfamily.org/dox-devel/TutorialMatrixArithmetic.html#TutorialArithmeticDotAndCross,
the following already works in Eigen3 (beta1 or trunk):
double mdist = data.transpose()*covInverse*data;
And this is the unique exception where this is allowed. Indeed,
unfortunately, allowing automatic conversion for any 1x1 matrix leads
to many ambiguities (I don't remember exactly but there is a old
thread where I listed them).
gael
On Wed, Sep 22, 2010 at 2:24 AM, Thomas Capricelli
<orzel@xxxxxxxxxxxxxxx> wrote:
> This, is really a dot product... a.dot(b)*c;
>
> Actually, i think most of the time, when someone wants to cast a 1x1 matrix
> to a scalar, he missed a dot product somewhere.
>
> And i'm against such an automatic casting as well.
>
> regards,
>
> Thomas
>
> --
>
> Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
>
> http://www.freehackers.org/thomas
>
> On Tuesday 21 September 2010 20:21:44 Christoph Hertzberg wrote:
>
>> Eigen::Vector3d a, b, c;
>
>> a.transpose() * b * c;
>
>>
>
>> or only explicitly:
>
>>
>
>> double(a.transpose()*b) * c;