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

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx
*Subject*: [eigen] Bug in SVD applied to specific matrix sizes
*From*: Jens Andersen <jens.andersen@xxxxxxxxx>
*Date*: Sun, 15 Mar 2009 15:01:18 +0100
*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=zWEcNMFK9ftWPxblKr3R6mWDui1Dm1xBP/BaEDUMifc=; b=l0knDmpbIngaCBaO3s+h9Df6Ifvn1+wBArJFZ5VK05k/06Vnu1ZvfRzV6RJhk3Dk7n 3Sh0DmAYmHpip+Hg5NveJqNc61x5FGTIUVLTpR7LxikjqKC+SM+BmZvrsbci2P7rg2hE WxP7pbUvt3YdE2bVe1eXU7Km07oG4EnG9wjqY=
*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=j6lbdwo3vspp7tU4P1Ns9W5C/E4kGMjeHycjIfowmQeu7JhKQV1QaDgTnUU5y3RYar PAk+3VagMgNV4Ah1OSF2eeE4cR0w4Fw+00UsjkzxluXOV2oP4QjwYyzpJ/wJmU51qfrq 03kq1RuuMzc7mH5ru6jxQCMfNB6qO1sy/1AtY=

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