LAPACK Archives

[Lapack] linear least square solutions from dgeqp3+dormqr+dtrtrs were di

Dear lapack developer:
    I used clapck to solve a linear least square problem (Ax=b), but I found
the solutions were different from SAS 9.1 and Matlab R2010a.
Routine dgeqp3 was used for a *QR* Factorization with Column Pivoting, after
removing dependent columns, the dormqr was used for Q'*y, finaly, dtrtrs for
inv(R)*Q'*y.
The routines I used are dgeqp3, dormqr and dtrtrs, and the design matrix A
is rank-deficient.
please find the attached files as the data, please help.

A is a 324*61 matrix stored by columns, and b is a 324*1 vector stored by
column.

R code:
A <- scan("A")
b <- scan("b")
A <- matrix(A,nrow=324,ncol=61)
b <- matrix(b,nrow=324,ncol=1)
tol <- 1e-8
m <- nrow(A)
n <- ncol(A)
qrA <- qr(A,LAPACK=TRUE)
jpvt <- qrA$pivot
R <- qr.R(qrA)
Q <- qr.Q(qrA)
p <- sum(abs(diag(R))>tol)
R <- R[1:p,1:p]
Q <- Q[,1:p]
jpvt <- jpvt[1:p]
x <- rep(0,n)
x[jpvt] <- solve(R, t(Q)%*%b)

-- 
???
He Jianbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://lists.eecs.utk.edu/mailman/private/lapack/attachments/20101107/0a0d5c8b/attachment-0001.html
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: A
Type: application/octet-stream
Size: 41363 bytes
Desc: not available
Url : 
http://lists.eecs.utk.edu/mailman/private/lapack/attachments/20101107/0a0d5c8b/A-0001.obj
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b
Type: application/octet-stream
Size: 2003 bytes
Desc: not available
Url : 
http://lists.eecs.utk.edu/mailman/private/lapack/attachments/20101107/0a0d5c8b/b-0001.obj
 

<Prev in Thread] Current Thread [Next in Thread>
  • [Lapack] linear least square solutions from dgeqp3+dormqr+dtrtrs were different from SAS/Matlab, He Jianbo <=


For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or