[R] memory: as.single in .Fortran creates another double

Wiener, Matthew matthew_wiener at merck.com
Thu Nov 29 21:20:40 CET 2001

Hi, everyone.

As mentioned in my message of earlier today, I'm trying to do hierarchical
clustering on a data set that's probably too big.  I may have to take a
subset eventually, but I'm spending a little time trying to try to reduce
memory use in the hope that I'll manage to do the full set.

One thing that occurred to me was to modify the underlying fortran code
(hclust.f, from library mva) to use single precision rather than double
precision.  I changed "DOUBLE PRECISION" to "REAL" in the fortran code and
saved the function as hclustsingle.f.  It created a .so file without
problem.  The hope is, of course, that I'll use half as much memory.

When I call hclustsingle, though, I get the same error as before (with the
same amounts of memory), and the traceback says:

11: structure(.Internal(as.vector(x, "double")), Csingle = TRUE)
10: as.single.default(d)
9: as.single(d)

So it looks as though changing to single can't help because the external
function interface creates a double precision vector anyway.

Is this correct?

Thanks very much.

Matthew Wiener
Applied Computer Science and Mathematics Department
Merck Research Labs
Rahway, NJ  07065-0900

r-help 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-help-request at stat.math.ethz.ch

More information about the R-help mailing list