[Rd] NaN in crossprod

From: McGehee, Robert <Robert.McGehee_at_geodecapital.com>
Date: Fri, 15 Jun 2007 12:20:08 -0400

I have come across a troubling problem in which my call to crossprod will occasionally produce NaNs. That is, a proper matrix cross-product will be produced except that some of the matrix elements will arbitrarily be NaN. For my purposes, this is extremely bad. On several different R sessions run this morning this example below may fail a few times out of a million, though sometimes not at all.
> x <- matrix(1, 100, 100); w <- rep(1, 100)
> for(i in 1:1000000) if(any(is.na(crossprod(w,x)))) cat("!")

Unfortunately, this error has been hard to reproduce as I was finding frequent NaNs produced an hour ago but am not finding any such cases now. I'm using a shared network computer so it's possible the computer was under different resource constraints when the problem occurred. I compiled R 2.5.0 on an Intel Xeon(P4) processor running Linux 2.4.21-47.0.1 on Red Hat AS 3.0, with ATLAS 3.7.30 BLAS support.

My _guess_ is that the problem is on the ATLAS end (bug, bad compilation, etc.), though as I can't seem to reproduce the problem in the past hour, I'm not sure I'd even know if I had "fixed" it by using a different version of ATLAS, or recompiling, etc. And not being quite sure how crossprod works internally, my guess is not even an educated one. So, lest the NaNs be a symptom of impending hardware failure, solar flares, or even a "mis-feature" in R, I thought I'd solicit any comments, ideas, and suggestions this group might have.


> R.version _

platform       i686-pc-linux-gnu
arch           i686
os             linux-gnu
system         i686, linux-gnu
major          2
minor          5.0
year           2007
month          04
day            23
svn rev        41293
language       R

version.string R version 2.5.0 (2007-04-23)

Robert McGehee, CFA
Quantitative Analyst
Geode Capital Management, LLC
One Post Office Square, 28th Floor | Boston, MA | 02109 Tel: 617/392-8396 Fax:617/476-6389

This e-mail, and any attachments hereto, are intended for us...{{dropped}}

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 15 Jun 2007 - 16:52:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 16 Jun 2007 - 10:34:56 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.