qr menghitung dekomposisi QR suatu matriks.
qr(x, …)
# S3 method for default
qr(x, tol = 1e-07 , LAPACK = FALSE, …)<p></p><p>qr.coef(qr, y)
qr.qy(qr, y)
qr.qty(qr, y)
qr.resid(qr, y)
qr.fitted(qr, y, k = qr$rank)
qr.solve(a, b, tol = 1e-7)
# S3 method for qr
solve(a, b, …)</p><p>is.qr(x)
as.qr(x)</p>
| Parameter | Deskripsi |
|---|---|
x |
a numeric or complex matrix whose QR decomposition is to be computed. Logical matrices are coerced to numeric. |
tol |
the tolerance for detecting linear dependencies in the columns of x. Only used if LAPACK is false and x is real. |
qr |
a QR decomposition of the type computed by qr. |
y, b |
a vector or matrix of right-hand sides of equations. |
a |
a QR decomposition or (qr.solve only) a rectangular matrix. |
k |
effective rank. |
LAPACK |
logical. For real x, if true use LAPACK otherwise use LINPACK (the default). |
… |
further arguments passed to or from other methods |
# NOT RUN {
hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, "+") }
h9 <- hilbert(9); h9
qr(h9)$rank #--> only 7
qrh9 <- qr(h9, tol = 1e-10)
qrh9$rank #--> 9
##-- Solve linear equation system H %*% x = y :
y <- 1:9/10
x <- qr.solve(h9, y, tol = 1e-10) # or equivalently :
x <- qr.coef(qrh9, y) #-- is == but much better than
#-- solve(h9) %*% y
h9 %*% x # = y
## overdetermined system
A <- matrix(runif(12), 4)
b <- 1:4
qr.solve(A, b) # or solve(qr(A), b)
solve(qr(A, LAPACK = TRUE), b)
# this is a least-squares solution, cf. lm(b ~ 0 + A)
## underdetermined system
A <- matrix(runif(12), 3)
b <- 1:3
qr.solve(A, b)
solve(qr(A, LAPACK = TRUE), b)
# solutions will have one zero, not necessarily the same one
# }