From murdoch at stats.uwo.ca  Mon Mar 19 14:01:39 2007
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 19 Mar 2007 09:01:39 -0400
Subject: [Rd] eigen returns NAs from a real matrix
In-Reply-To: <17918.27271.48263.371325@stat.math.ethz.ch>
References: <45FCCCC5.3060806@pdf.com>	<Pine.LNX.4.64.0703180651080.24029@gannet.stats.ox.ac.uk>
	<17918.27271.48263.371325@stat.math.ethz.ch>
Message-ID: <45FE89B3.5050505@stats.uwo.ca>

On 3/19/2007 6:48 AM, Martin Maechler wrote:
>>>>>> "BDR" == Prof Brian Ripley <ripley at stats.ox.ac.uk>
>>>>>>     on Sun, 18 Mar 2007 06:51:58 +0000 (GMT) writes:
> 
>     BDR> On Sat, 17 Mar 2007, Spencer Graves wrote:
>     >> Hi, All:
>     >> Attached please find a symmetric, indefinite matrix for which 
>     >> 'eigen(...)$vectors' included NAs: 
>     >>> load("eigenBug.Rdata")
>     >>> sum(is.na(eigen(eigenBug)$vectors))
>     >> [1] 5670
>     >>> sessioninfo()
>     >> Error: could not find function "sessioninfo"
>     >>> sessionInfo()
>     >> R version 2.4.1 (2006-12-18)
>     >> i386-pc-mingw32
>     >> 
>     >> locale:
>     >> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
>     >> States.1252;LC_MONETARY=English_United 
>     >> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>     >> 
>     >> attached base packages:
>     >> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods" [7] 
>     >> "base"
>     >> Using EISPACK does NOT return NAs: > sum(is.na(eigen(eigenBug, 
>     >> EISPACK=TRUE)$vectors))
>     >> [1] 0
>     >> 
>     >> 
>     >> I traced the problem to the following line in 'eigen':
>     >> z <- if (!complex.x)
>     >> .Call("La_rs", x, only.values, PACKAGE = "base")
>     >> 
>     >> 
>     >> Comments?
> 
>     BDR> Nothing appeared as an attachment.
> 
> it was a zip file which is not among the allowed ones
> (.tar.gz / *.tgz  would work).
> 
> Spencer has also contacted me in private,
> so you now can use something like :
> 
>   F <- tempfile()
>   download.file("ftp://stat.ethz.ch/U/maechler/R/eigenBug.Rdata", F)
>   load(F)

This is unrelated to Spencer's problem, but this sequence failed for me. 
  By default it will treat the file as a text file, and convert EOL 
markers for Windows.  Adding "mode='wb'" to the download.file() call is 
necessary.

>   str(eigenBug)# tons of dinames; get rid of them:
>   M <- unname(eigenBug)
> 
>   sum(is.na(eigen(M)$vectors))
>   # 0 (for MM, on Linux);  '5670' for Spencer

I get the same as Spencer in 2.4.1, but zero in R-devel, in Windows.  I 
haven't tried R-patched yet:  there were network problems here this 
morning, and the build failed.

Duncan Murdoch

>   sum(is.na(eigen(M, EISPACK=TRUE)$vectors))
>   # 0
> 
>   ## Guess about what kind of BLAS/Lapack I'm using :
>   file.info(list.files(R.home("lib"), full=TRUE))[,1:3]
>   ##                                        size isdir mode
>   ## ....64-linux-inst/lib/libRblas.so    422558 FALSE  755
>   ## ....64-linux-inst/lib/libRlapack.so 3144596 FALSE  755
> 
> 
> I.e. I don't get any NA's
> which shows to me that the bug is most probably in the Lapack -
> Version that Spencer's version of R is linked against.
> 
> Martin Maechler, ETH Zurich
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] eigen returns NAs from a real matrix
Duncan Murdoch