[Rd] qr.qy and qr.qty give an error message when y is integer and LAPACK=TRUE

From: Berend Hasselman <bhh_at_xs4all.nl>
Date: Mon, 03 Dec 2012 15:25:21 +0100

With this example

set.seed(123)
A <- matrix(runif(40), nrow = 8)
y <- 1:nrow(A)

A.laqr <- qr(A, LAPACK=TRUE)

both qr.qy(A.laqr,y) and qr.qty(A.laqr,y) give the respective error messages

Error in qr.qy(A.laqr, y) : 'b' must be a numeric matrix Error in qr.qty(A.laqr, y) : 'b' must be a numeric matrix

However when Lapack is not used as in

A.liqr <- qr(A, LAPACK=FALSE)

qr.qy(A.liqr,y) and qr.qty(A.liqr,y) don't issue error messages.

Looking at the source of qr.qy and qr.qty in https://svn.r-project.org/R/trunk/src/library/base/R/qr.R I see that in the case of Lapack the storage.mode of y is not set to "double" (in contrast to when Linpack QR has been used).

I assume that the error issued when LAPACK=TRUE is not intended.

Berend

Suggested code change in qr.qy
Replace

    if(!is.null(a) && is.logical(a) && a)

        return(.Call("qr_qy_real", qr, as.matrix(y), 0, PACKAGE = "base"))

with

    if(!is.null(a) && is.logical(a) && a) {

        storage.mode(y) <- "double"
        return(.Call("qr_qy_real", qr, as.matrix(y), 0, PACKAGE = "base"))
    }

and a similar change in qr.qty



R-devel_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 03 Dec 2012 - 14:29:32 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 03 Dec 2012 - 15:52:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive