[Rd] NA's in eigen(), La.eigen() (PR#3723)

jerome at hivnet.ubc.ca jerome at hivnet.ubc.ca
Tue Aug 12 01:09:48 MEST 2003


R version: 1.7.1
OS: Red Hat Linux 7.2

Hello,

eigen() and La.eigen() seem to have inconsistent behavior in cases where 
NA's are present in the input matrix. In some cases, eigen() and 
La.eigen() seem to get stuck in an infinite loop. See examples below.

I would expect something like an error message whenever NA's are present 
in the input matrix.

Sincerely,
Jerome Asselin

######################
La.eigen(matrix(c(1,0,0,1),2,2))                   #Works
La.eigen(matrix(c(1,NA,0,1),2,2))                  #Returns something
La.eigen(matrix(c(1,0,0,NA),2,2))                  #Returns something
La.eigen(matrix(c(1,NA,NA,1),2,2))                 #Infinite loop (?)
La.eigen(matrix(c(1,NA,NA,1),2,2),method="dsyev")  #All NA's
eigen(matrix(c(1,NA,NA,1),2,2))                    #Infinite loop (?)
eigen(matrix(c(1,NA,NA,1),2,2),EISPACK=T)          #Returns Error

#Illustration of what happens over 32 dimensions
mat <- diag(32); mat[2,2] <- NA
system.time(eigen(mat))             #Returns something
mat <- diag(33); mat[2,2] <- NA
system.time(eigen(mat))             #Infinite loop (?)
mat <- diag(33); mat[1,1] <- NA
system.time(eigen(mat))             #Returns something
mat <- diag(33); mat[2,2] <- NA
system.time(eigen(mat,EISPACK=T))   #Returns Error
######################


-- 

Jerome Asselin (Jérôme), Statistical Analyst
British Columbia Centre for Excellence in HIV/AIDS
St. Paul's Hospital, 608 - 1081 Burrard Street
Vancouver, British Columbia, CANADA V6Z 1Y6
Email: jerome at hivnet.ubc.ca
Phone: 604 806-9112   Fax: 604 806-9044



More information about the R-devel mailing list