Re: [eigen] inconsistency in fast eigen decomposition |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] inconsistency in fast eigen decomposition
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Thu, 3 Feb 2011 11:29:44 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=R4pRBqfxY5u68cRX//aC994ecsaRE5289w5z/iV3XRc=; b=tLfyuBP6ttOg8Q8dpzwLw5g7RfggaTRgXctBzy9BQ0izfYm0pCuJSLN/Ey/H/0glnp IugCUIfycoTADRbN2Of9MejQa4ihah4aXXN3j6Duzm4s248dYiC9aRCdnH+x0bRwvvJJ eZy//cZVQIx/2kBGBlmk/C/ZpCYvgMmh0zKNw=
- 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=V6DH7iyZuXopxqBWTJNMZCfKSCCAL6g5I5jJIkJVole0Tmv3qI5irWe/kVaodWJtgS xi6G1kGbXErJn297SFOiESuf3wPUC9cvpTFYTlFLsAuKclXPafjJwI1SfNHIJSDhxj2i VJL4Jm7VTk2B6kf1IeSBbcm6DYh0zQ1m31Fac=
Hi,
indeed, the code to extract the eigen vectors was quite naive. I've
committed a more accurate version which should work fine for most use
cases.
I assume you are doing planar fit right? If so then the new version
should really really be enough for you. It lacks some accuracy (but
not too bad) only when all eigenvalues are relatively closed to each
other. In this case there is no good planar approximation anyway.
gael
On Thu, Feb 3, 2011 at 7:41 AM, Radu Bogdan Rusu <rusu@xxxxxxxxxxxxxxxx> wrote:
> Hi all,
>
> Gael, we've been using the fast eigen decomposition suggested by you in an
> e-mail back in 09/02/10 (regarding SelfAdjointEigenSolver<Matrix3f> -
> http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2010/08/msg00283.html)
> without any major issues for the past few months.
>
> We've recently hit a problem, and I was wondering whether there is a fix for
> it that doesn't involve switching to another SVD/eigendecomposition method
> in Eigen, as the implementation that we're using (see attached source) is
> still blazing fast.
>
> Here's the snippet of code that exhibits the problem (not that it's a c&p so
> please ignore the style/format):
>
> Eigen3::Matrix3f covariance_matrix_f;
> covariance_matrix_f << 5.64909, 5.64909, 0.0860435, 5.64909, 5.64909,
> 0.0860435, 0.0860435, 0.0860435, 2.92133;
>
> Eigen3::SelfAdjointEigenSolver<Eigen3::Matrix3f> ei_symm
> (covariance_matrix_f);
> Eigen3::Vector3f eigen_values = ei_symm.eigenvalues ();
> Eigen3::Matrix3f eigen_vectors = ei_symm.eigenvectors ();
>
> cerr << eigen_vectors << endl;
> cerr << eigen_values << endl;
> cerr << "Normal: " << eigen_vectors (0, 0) << ", " << eigen_vectors (1, 0)
> << ", " << eigen_vectors (2, 0) << endl;
>
> Eigen3::Vector3f eigen_val;
> Eigen3::Matrix3f eigen_vec;
> eigen33 (covariance_matrix_f, eigen_vec, eigen_val);
>
> cerr << eigen_vec << endl;
> cerr << eigen_val << endl;
> cerr << "Normal: " << eigen_vec (0, 0) << ", " << eigen_vec (1, 0) << ", "
> << eigen_vec (2, 0) << endl;
> ----
>
> The output is:
>
> 0.707107 -0.0102705 0.707032
> -0.707107 -0.0102656 0.707032
> 3.48268e-06 0.999894 0.0145212
> 3.41638e-08
> 2.91956
> 11.2999
> Normal: 0.707107, -0.707107, 3.48268e-06
>
> -0.00781202 0.0102683 0.707032
> -0.00781202 0.0102683 0.707032
> 0.999939 -0.999895 0.0145207
> -1.01014e-06
> 2.91956
> 11.2999
> Normal: -0.00781202, -0.00781202, 0.999939
> ---
>
>
> Thanks in advance.
>
>
> Cheers,
> Radu.
> --
> http://pointclouds.org
>