Re: .Fortran to .Call

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: .Fortran to .Call

R devel mailing list
  Over the years I have converted many of the .C calls in the survival package to .Call. 
As others have said, the big advantage is memory footprint.  I did it because there are a
few users who call survfit or coxph with really large data sets, and not copying the data
can be the difference between success and failure (run out of memory).  Like you, my
experience has been that if there is enough memory, then the time required for .C or
.Fortran to make the data copy is minimal.   Don't make the change in order to gain
compute speed.

The downside to .Call is that R then makes the (dangerous) assumption that you know what
you are doing.  That is, vectors/matrices that are passed in to the function will NOT have
new data values written into them, unless you have taken the necessary steps.   Breaking
the promise can lead to program failures that are very hard to track down.

Terry M Therneau, PhD
Department of Health Science Research
Mayo Clinic
[hidden email]

"TERR-ree THUR-noh"

        [[alternative HTML version deleted]]

[hidden email] mailing list