Computes the QR decomposition of a matrix.

qrD(x, tol = 1e-07)

Arguments

x

A matrix whose QR decomposition is to be computed.

tol

The tolerance for finding linear dependence in columns of x.

Value

A list of two matrices: Q and R.

Details

Calls function qr and returns more understandable output.

See also

Examples

hilbert <- function(n) { i <- 1:n 1 / outer(i - 1, i, "+") } h5 <- hilbert(5) qrD(h5)
#> $q #> [,1] [,2] [,3] [,4] [,5] #> [1,] 0.8265843 0.5333546 0.17530535 0.03910207 -0.005504735 #> [2,] 0.4132921 -0.3740535 -0.71726240 -0.40334521 0.110094708 #> [3,] 0.2755281 -0.4629460 -0.05766473 0.67896462 -0.495426188 #> [4,] 0.2066461 -0.4433191 0.35262561 0.20615371 0.770662959 #> [5,] 0.1653169 -0.4059138 0.57195511 -0.57644719 -0.385331479 #> #> $r #> [,1] [,2] [,3] [,4] [,5] #> [1,] 1.209798 0.6888202 0.492014463 0.3854113295 3.177593e-01 #> [2,] 0.000000 -0.1300598 -0.140191904 -0.1327002361 -1.223229e-01 #> [3,] 0.000000 0.0000000 0.008065379 0.0126325450 1.490829e-02 #> [4,] 0.000000 0.0000000 0.000000000 -0.0003381217 -6.893147e-04 #> [5,] 0.000000 0.0000000 0.000000000 0.0000000000 -8.737675e-06 #>