From jerome at hivnet.ubc.ca  Tue Aug 12 01:09:48 2003
From: jerome at hivnet.ubc.ca (jerome@hivnet.ubc.ca)
Date: Tue Aug 12 00:09:24 2003
Subject: [Rd] NA's in eigen(), La.eigen() (PR#3723)
Message-ID: <200308112209.h7BM9mJH015838@pubhealth.ku.dk>

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 (Jrme), 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@hivnet.ubc.ca
Phone: 604 806-9112   Fax: 604 806-9044


[Rd] NA's in eigen(), La.eigen() (PR#3723)
jerome@hivnet.ubc.ca