From edd at debian.org  Sun Jul 31 04:15:49 2005
From: edd at debian.org (Dirk Eddelbuettel)
Date: Sat, 30 Jul 2005 21:15:49 -0500
Subject: [Rd] eigen gives NaN in $vectors (PR#8041)
In-Reply-To: <20050731015351.248AA1132F@slim.kubism.ku.dk>
References: <20050731015351.248AA1132F@slim.kubism.ku.dk>
Message-ID: <17132.13397.506098.656586@basebud.nulle.part>


On 31 July 2005 at 03:53, pkapat_nospam at stat.ohio-state.edu wrote:
| Full_Name: P Kapat
| Version: 2.1.1 (2005-06-20)
| OS: GNU/Linux 2.6.8-2-386, Debian testing
| Submission from: (NULL) (65.24.56.41)
| 
| 
| Relevant Bugs Ids : 7987, 7989
| 
| H is a 100x100 singular but symmetric matrix (a matrix defining the
| neighbourhood structure for a spatial data) available from..
| http://www.stat.ohio-state.edu/~pkapat/miscl/bugMatrix.RData
| 
| > load(file="bugMatrix.RData")
| > ls()
| "H"
| > I <- diag(rep(1,100))
| > g <- 0.1318467
| > M <- I - g*H 
| > y <- eigen(M)
| > y$vec[,91]
| ## all NaNs
| 
| Interestingly, as suggested in bug id 7989, this is very sensitive to the
| scaling factor g. The error dissapears with even a slightly different value of
| g, like 0.131846 instead of 0.1318467.
| 
| I run a Debian/testing (2.6.8-11 kernel) on Dell P4 i386 arch. This error does
| not occur on Windows XP (R 2.1.1) or Red Hat Enterprise GNU/Linux 2.6.9-11
| running R 2.1.1. I have tried on both of them. Seems like a wiered bug !!

Could you show us the output of 'ldd /usr/lib/R/lib/libR.so' to see which
blas library your are linked to? On my Debian testing (plus my local archive
of things going to Debiin unstable) machine I see

edd at basebud:~> ldd /usr/lib/R/lib/libR.so
        libblas.so.3 => /usr/lib/atlas/3dnow/libblas.so.3 (0xb788b000)
        libg2c.so.0 => /usr/lib/libg2c.so.0 (0xb786d000)
        libm.so.6 => /lib/tls/libm.so.6 (0xb784a000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb783f000)
        libreadline.so.5 => /lib/libreadline.so.5 (0xb7812000)
        libpcre.so.3 => /usr/lib/libpcre.so.3 (0xb77ea000)
        libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0xb77db000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb77c9000)
        libdl.so.2 => /lib/tls/libdl.so.2 (0xb77c5000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb7690000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
        libncurses.so.5 => /lib/libncurses.so.5 (0xb7651000)

where the first line matters -- this Athlon system has the corresponding
Athlon ATLAS libraries installed. With that, I *cannot* reproduce your bug:

> load(url("http://www.stat.ohio-state.edu/~pkapat/miscl/bugMatrix.RData"))
> ls()
[1] "H"
> I <- diag(rep(1,100))
> g <- 0.1318467
> M <- I - g*H 
> y <- eigen(M)
> y$vec[,91]
  [1]  0.064994365  0.095269861  0.093356381  0.093002077  0.117163201
  [6]  0.149338128  0.151908900  0.110123012  0.050293258  0.010859822
 [11]  0.083452682  0.103623840  0.068440931  0.045219013  0.079837036
 [16]  0.141580270  0.158260380  0.100615858  0.017314370 -0.020430745
 [21]  0.060861312  0.037783017 -0.053999270 -0.116936079 -0.084425327
 [26]  0.001884144  0.041081891 -0.009022666 -0.082867040 -0.084354982
 [31]  0.046121709 -0.006589538 -0.137775925 -0.228347114 -0.196939213
 [36] -0.093055786 -0.038154216 -0.083641382 -0.151805832 -0.128662892
 [41]  0.072554437  0.035751182 -0.089922517 -0.176261323 -0.135718368
 [46] -0.022677002  0.030698204 -0.031015693 -0.122266788 -0.117638460
 [51]  0.117638460  0.122266788  0.031015693 -0.030698204  0.022677002
 [56]  0.135718368  0.176261323  0.089922517 -0.035751182 -0.072554437
 [61]  0.128662892  0.151805832  0.083641382  0.038154216  0.093055786
 [66]  0.196939213  0.228347114  0.137775925  0.006589538 -0.046121709
 [71]  0.084354982  0.082867040  0.009022666 -0.041081891 -0.001884144
 [76]  0.084425327  0.116936079  0.053999270 -0.037783017 -0.060861312
 [81]  0.020430745 -0.017314370 -0.100615858 -0.158260380 -0.141580270
 [86] -0.079837036 -0.045219013 -0.068440931 -0.103623840 -0.083452682
 [91] -0.010859822 -0.050293258 -0.110123012 -0.151908900 -0.149338128
 [96] -0.117163201 -0.093002077 -0.093356381 -0.095269861 -0.064994365
> 

No NaNs here.

Kudos for providing a complete bug report. Now let's see it hits you but not
me ...

Cheers,  Dirk

| 
| Kapat
| Dept. of Stat. OSU.
| 
| ______________________________________________
| R-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Statistics: The (futile) attempt to offer certainty about uncertainty.
         -- Roger Koenker, 'Dictionary of Received Ideas of Statistics'



[Rd] eigen gives NaN in $vectors (PR#8041)
Dirk Eddelbuettel