From sundard at pdf.com  Mon Dec 22 16:05:30 2003
From: sundard at pdf.com (sundard@pdf.com)
Date: Mon Dec 22 16:03:56 2003
Subject: [Rd] La.eigen hangs R when NaN is present (PR#6003)
Message-ID: <20031222150530.420DF104AE@slim.kubism.ku.dk>

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)


[Rd] La.eigen hangs R when NaN is present (PR#6003)
sundard@pdf.com