|Re: [eigen] Convert 1x1 matrix to internal type?|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Convert 1x1 matrix to internal type?
- From: Li Wei <lwthucs@xxxxxxxxx>
- Date: Fri, 17 Sep 2010 09:48:46 +0800
- 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; bh=OvkBLQJJ5Z8FKDQmn+hpN3IAaIoQKOY9I0NGRr35ga4=; b=QuX9D3uM5aIVC6lMJKUW2lMKBogJFpOFwlOLEMejXfd5BH8x2Z0teGYGyjnV2Bm2WE hjlW5ED/lZoUyRyk5v8h8dziqPPkODEJoc20ifmdZWdywIrMCXdiD6dE3fsdWKCM5QK0 ur+YYCk6fO1v7wf0D0NrrgVtLUWNvvt2Z44NA=
- 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; b=yILLiTLDlidfXiXAZbjnDq2/5ODn/Vx7HcuO3Q8F48FR5XV5xTeGAOa4LJ8rPf3cXU GO8PIr38uaIYl11sEqQYfSryKfNRb0+wOYZvA+lpXEzOLKIvCsZmmdUEZv8vRWaCpinA FJjhTVqz7eaA2Eg4a67lCUXRjGmD0Y4IqmSVo=
How about converts to any matrix double type to its first element(top-left corner) in release mode by default, but with dimensionality check in debug mode.
On Thu, Sep 16, 2010 at 3:33 AM, <lfrfly@xxxxxxxxxxx>
It seems to me that a 1x1 matrix ought to be convertible to its internal type. Maybe it is, but if so, there's some kind of problem. Consider the computation for Mahalanobis distance:
Matrix2d covariance, covInverse;
double mdist = data.transpose()*covInverse*data;
You would think this would work fine, since the result ix 1x1. However, it gives an error that an Eigen::Multiply cannot be converted to a double.
I can get around this by doing
double mdist = (data.transpose()*covInverse*data);
but that's a bit awkward. What is the "correct" solution to this issue?
Best Wishes From
Dep. of Computer Science and Technology, Tshinghua Univ.