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

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

This doesn't quite work, as only the columns of U corresponding to non-null
singular values will be computed, and what he's looking for is the
null-space vector. Just take your 8 x 9 matrix A and augment it with a row
of zeros.
Cheers,
James
On Mon, 16 Mar 2009 11:59:11 +0100 (CET), Helmut Jarausch
<jarausch@xxxxxxxxxxxxxxxxxxx> wrote:
> On 15 Mar, Jens Andersen wrote:
>> 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.
>>
>
> As a workaround (not more) you can compute the SVD of the transposed
> matrix. If A^T has the SVD V*Sigma*U^T then A itself has the SVD
> U*Sigma*V^T .