Re: [eigen] Changed behavior of jacobisvd
• To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
• Subject: Re: [eigen] Changed behavior of jacobisvd
• From: Rob Conde <rob.conde@xxxxxxxxxxxxxxxx>
• Date: Fri, 5 Jun 2015 13:53:57 +0000
• Accept-language: en-US
• Authentication-results: lists.tuxfamily.org; dkim=none (message not signed) header.d=none;
• Thread-index: AQHQnjNwpkNf7kFwF0ecR4aY4iF+PJ2dnXmAgABUMzU=
• Thread-topic: [eigen] Changed behavior of jacobisvd

```Thanks for your thoughts!

Rob

________________________________
From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
Sent: Friday, June 5, 2015 4:52 AM
To: eigen
Subject: Re: [eigen] Changed behavior of jacobisvd

Hi,

no big deal as the third singular value is still numerically zero compared to the largest one, and I'm pretty sure that you can build examples exhibiting the opposite behavior. For the record, the precise changes at the origin of this change of behavior are in the computation of the 2x2 SVD:

old:

RealScalar u = d / t;
rot1.c() = RealScalar(1) / sqrt(RealScalar(1) + numext::abs2(u));
rot1.s() = rot1.c() * u;

new:

RealScalar t2d2 = numext::hypot(t,d);
rot1.c() = abs(t)/t2d2;
rot1.s() = d/t2d2;
if(t<RealScalar(0))
rot1.s() = -rot1.s();

the old one is subject to underflow and overflow issues, and it does not pass our unit tests. I'm open to better suggestions for this portion of the code. Its purpose is to construct a rotation R such that R * M is symmetric (M being real and 2x2) with t and d as follows:
t = m(0,0) + m(1,1);
d = m(1,0) - m(0,1);

cheers,
gael

On Wed, Jun 3, 2015 at 9:28 PM, Rob Conde <rob.conde@xxxxxxxxxxxxxxxx<mailto:rob.conde@xxxxxxxxxxxxxxxx>> wrote:

I'm not sure if this is a sign of anything wrong, but I noticed the following change in updating from eigen 3.2.1 to 3.2.4 using Visual Studio 2013.

For the matrix:

1 2 3
0 0 0
7 8 9

JacobiSVD used to give 0 as the minimum singular value. Now it is 1.4079439049813084e-033

MATLAB and Wolfram Alpha give 0.

```

 Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/