Hello all, In a piece of c++ code (part of a future R package), I'm inverting a relatively large covariance matrix many times using: F77_CALL(dpotrf)(&upper, &xnrow, R, &xnrow, &info); F77_CALL(dpotri)(&upper, &xnrow, R, &xnrow, &info); I am sure that the input matrix is PD and inverts just fine. However, I have found that dpotri gives one or more NaNs from time-to-time in the upper (or lower depending on the specification) triangle. When I say, from time-to-time, I mean without warning in perhaps 1 in ~25 runs (but is highly variable). Also, when the NaNs occur, dpotri does not return an error in info. I have spent many many hours trying to get this error to reproduce predictably, but cannot. Even with the same input matrix, sometimes I get a NaN but most of the time I do not, and their occurrence seems to be random and random in the matrix. When dpotri, does not produce the NaN, the solution is correct. To assure myself that I was not totally nuts, I tried both Linpack's dpodi and a chol2inv routine from Numerical Recipes in place of dpotri. Both of these routines never produce the nan and provide the correct result. I hesitate to post this problem, as I cannot get it to reproduce on a regular basis. Valgrind didn't report any memory access problems on my code. Has anybody seen this before, or might point out some stupid mistakes I could be making? Thanks for your time, Andrew R Version 2.3.0 (2006-04-24) Debian Linux 2.6.15-1-686 Research Fellow Department of Forest Resources University of Minnesota Office: 305 Green Hall Phone: (612) 624-1714 Fax: (612) 625-5212 web: http://blue.fr.umn.edu