From ihaka@stat.auckland.ac.nz  Sun Oct 19 01:53:40 1997
From: ihaka@stat.auckland.ac.nz (Ross Ihaka)
Date: Sun, 19 Oct 1997 13:53:40 +1300 (NZDT)
Subject: R-alpha: bug in svd
In-Reply-To: <199710170642.QAA10196@forde.anu.edu.au>
References: <199710170642.QAA10196@forde.anu.edu.au>
Message-ID: <199710190053.NAA17919@stat1.stat.auckland.ac.nz>

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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: bug in svd
Ross Ihaka