A matrix (array of rows) or a QR decomposition from qr.
Optionalb: VectorOrMatrix
The right-hand side, a vector or a matrix. Default: the identity matrix.
tol: the tolerance passed to qr when a is a matrix. Default: 1e-7.
A vector if b is a vector, otherwise an array of rows.
Solves
a x = bin the least-squares sense using a QR decomposition. Equivalent to R'sqr.solve().Throws if the rank is less than
min(nrow, ncol). Whenbis omitted, returns the inverse ofa(square matrices only). For a wide matrix, coefficients of unused columns are set to 0 (as in R).A LAPACK decomposition (
qr(a, { lapack: true })) has no rank, so it throws instead if some|R[k][k]|is at mosttol * |R[0][0]|(tolfromoptions, default1e-7), which R'sqr.solve()does not detect.