Re: [eigen] Bug in SVD applied to specific matrix sizes

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Dear Jens,

The current SVD code, taken from JAMA, is known to have many issues.
It's on our TODO to rewrite the SVD completely. Although i've been
completely inactive in the past 6 weeks, I really still want to do
this for Eigen 2.1, that is, very soon.

So in the meanwhile I hope it's OK for you that we consider that it's
not worth trying to fix the old code... and I hope you can find a
short term solution that works for you.

Cheers,
Benoit


2009/3/15 Jens Andersen <jens.andersen@xxxxxxxxx>:
> Hi
> I have stumbled upon a bug in SVD when applying it to certain matrix sizes.
> The particular problem occured when doing a simple four-point Direct
> Linear Transform in reduced form, providing a matrix of size 8x9.
> In this case an attempt to set a value to an index out of bounds, in
> the array m_sigma.
> The particular code is shown here:
>  // Set up the final bidiagonal matrix or order p.
>  int p = std::min(n,m+1);
>  if (nct < n)
>    m_sigma[nct] = matA(nct,nct);
>  if (m < p)
>    m_sigma[p-1] = 0.0;
>
> m_sigma has size m, whereas p is set to n=m+1. In this particular case
> m_sigma[8] will be set, but m_sigma's highest index is 7.
>
> A quick test shows that this will consistently happen whenever the
> number of columns is greater than the number of rows.
>
> Unfortunately I don't know enough of Eigen's internal to create a
> reasonable fix.
>
> Regards,
> Jens Andersen
>
>
>



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