R-alpha: bug in svd
Ross Ihaka
ihaka@stat.auckland.ac.nz
Sun, 19 Oct 1997 13:53:40 +1300 (NZDT)
Andreas Weingessel writes:
>
> R> svd(matrix(1:16,4,4))
> yields on both machines
> Error: error 4 in dsvdc
This is a bug in the interpreted code. It assumes that its argument
is real valued. 1:16 produces an integer value. The fix is to change
the svd function so that the call to LINPACK is
z <- .Fortran("dsvdc", as.double(x), n, n, p, d = double(mm), double(p),
u = u, n, v = v, p, double(n), as.integer(job),
info = integer(1), DUP = FALSE)[c("d", "u", "v",
"info")]
i.e. you have to wrap an "as.double" around "x".
Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-