Learn R Programming

kazaam (version 0.1-0)

qr: QR Decomposition Methods

Description

QR factorization.

Usage

qr_R(x)

qr_Q(x, R)

Arguments

x

A shaq.

R

A regular matrix. This argument is optional, in that if it is not supplied explicitly, then it will be computed in the background. But if have already computed R, supplying it here will improve performance (by avoiding needlessly recomputing it).

Value

Q (a shaq) or R (a regular matrix).

Communication

The operation is completely local except for forming the crossproduct, which is an allreduce() call, quadratic on the number of columns.

Details

\(R\) is formed by first forming the crossproduct \(X^T X\) and taking its Cholesky factorization. But then \(Q = X R^{-1}\). Inverting \(R\) is handled by an efficient triangular inverse routine.

Examples

Run this code

library(kazaam)
x = ranshaq(runif, 10, 3)

R = qr_R(x)
comm.print(R)

Q = qr_Q(x, R)
Q

finalize()


Run the code above in your browser using DataLab