From pgilbert@bank-banque-canada.ca  Thu Feb 26 15:03:50 1998
From: pgilbert@bank-banque-canada.ca (Paul Gilbert)
Date: Thu, 26 Feb 1998 10:03:50 -0500
Subject: Bus Error
Message-ID: <98Feb26.101259est.13444@mailgate.bank-banque-canada.ca>

I was experimenting a bit with the memory saving trick mentioned on Snew
recently and I've discovered that adding NULL to the end of the loop in the
function below gives me "Bus Error - core dumped" in Solaris with R 0.61.1. The
problem does not occur every time the function is called, but it is reproducible
in the sense that I twice tried  a set of test I have and it occured in the the
same spot, and when I remove the NULL it does not occur. I also added a NULL in
some other loops with no problems, but no obvious time savings in R. For my
purposes I will just remove the NULL, since this is going to be very difficult
for me to isolate (it takes a hour on an ultra 10 to get to the point where the
error occurs). I thought I would mention the problem in the hope that someone
can  immediately see a bug.

Paul Gilbert
________

hessian.default <- function(func, x, func.args=NULL, d=0.01, eps=1e-4,r=6)
{  D <- genD.default(func,x,func.args=func.args, d=d, eps=eps, r=r)$D
   H <- diag(0,length(x))
   u <- 0
   for(i in 1:length(x))
     {for(j in 1:i)
        {u <- u + 1
         H[i,j] <- D[,u]
         NULL
     }  }
   H <- H +t(H)
   diag(H) <- diag(H)/2
   H
}



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Bus Error
Paul Gilbert