[Rd] Size of type double in object type dist (PR#1255)

Peter Kleiweg kleiweg@let.rug.nl
Fri, 11 Jan 2002 00:51:28 +0100 (CET)


kleiweg@let.rug.nl scribeva...

> Sometimes, the type of 'Size' of an object of type 'dist'
> changes from integer into double. Running cmdscale on such a
> 'dist' object gives invalid results.

I have done some further testing. It seems the storage mode of
'Size' was double from the start. Setting the storage mode to
integer does not fix the problem. (However, the problems occur
once attr(PA, "Size") no longer prints 67, but 67.00000)

There seems to be something wrong with the interaction of
the 'plot' function with objects of class 'dist' and
the 'cmdscale' function. I traced cmdscale:

function (d, k = 2, eig = FALSE)
{
[snip]

    storage.mode(x) <- "double"
    Tmat <- -0.5 * .C("dblcen", x, as.integer(n), PACKAGE = "mva")[[1]]

Up to this point, all goes well. The results in Tmat seem OK.
When things go wrong, the following command take a long time to
run:

    e <- La.eigen(Tmat, symmetric = TRUE)

[snip]

}

My best guess is that there is some memory problem (overflow,
null pointer assignment, whatever) when plot is applied to an
object of class 'dist', which causes another call to cmdscale on
the same object to go wrong.

If someone wants to try this, the problem occured running the
examples of the functions 'MDS', 'ISOMDS', and 'SAMMON' in the
'iLeven' package. That package can be downloaded from:

    http://www.let.rug.nl/~kleiweg/levenshtein/R/

Just running one example (any example) once works fine. Running
that example again, or running any of the other examples fails.

R versions 1.3.1 and 1.4.0 / Windows95

-- 
Peter Kleiweg

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._