Full_Name: Sundar Dorai-Raj Version: 1.8.1 OS: Windows 2000 Professional Submission from: (NULL) (12.64.199.173) I discovered this problem when trying to use princomp in package:mva when a column in my matrix was all zeros and I set cor = TRUE (thus division by 0). Doing so hangs R, never to return. I have to shut down Rterm in the Task Manager and lose all work from the current image. I tracked down the problem to using La.eigen when the input matrix has one or more NaN. Note that eigen(x, sym TRUE) gives a sensible result without hanging R.> version_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 1 minor 8.1 year 2003 month 11 day 21 language R> > x <- matrix(c(1, 1, 1, 0.5), 2, 2) > x[1, 1] <- NaN > x[,1] [,2] [1,] NaN 1.0 [2,] 1 0.5> eigen(x, sym = TRUE)$values [1] NA NA $vectors [1] NA NA NA NA> La.eigen(x, TRUE)La.eigen(x, TRUE)
Prof Brian Ripley
2003-Dec-22 16:15 UTC
[Rd] La.eigen hangs R when NaN is present (PR#6003)
>From the NEWS for R-patched:o Non-finite input values to eigen(), La.eigen(), svd() and La.svd() are now errors: they often caused infinite looping. (PR#5406, PR#4366, PR#3723: the fix for 3723/4366 returned a vector of NAs, not a matrix, for the eigenvectors.) so this is already fixed (and your example works there). On Mon, 22 Dec 2003 sundard@pdf.com wrote:> Full_Name: Sundar Dorai-Raj > Version: 1.8.1 > OS: Windows 2000 Professional > Submission from: (NULL) (12.64.199.173) > > > I discovered this problem when trying to use princomp in package:mva when a > column in my matrix was all zeros and I set cor = TRUE (thus division by 0). > Doing so hangs R, never to return. I have to shut down Rterm in the Task Manager > and lose all work from the current image. I tracked down the problem to using > La.eigen when the input matrix has one or more NaN. Note that eigen(x, sym > TRUE) gives a sensible result without hanging R.It did give an incorrect result: the eigenvector `matrix' wasn't a matrix.> > version > _ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 1 > minor 8.1 > year 2003 > month 11 > day 21 > language R > > > > x <- matrix(c(1, 1, 1, 0.5), 2, 2) > > x[1, 1] <- NaN > > x > [,1] [,2] > [1,] NaN 1.0 > [2,] 1 0.5 > > eigen(x, sym = TRUE) > $values > [1] NA NA > > $vectors > [1] NA NA NA NA > > La.eigen(x, TRUE) > La.eigen(x, TRUE) > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel > >-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595