Skip to contents

Consistent iff rank(A, b) = rank(A); with full column rank the solution is unique (A^-1 b when square) or, when inconsistent, the least-squares (A'A)^-1 A'b, both by QR (Hedderich, Sachs & Reynarowych 2023, eqs 2.47-2.50). A rank-deficient A gives x = NULL.

Usage

linsys(A, b, tol = 1e-07)

Arguments

A

n x m matrix.

b

Right-hand side.

tol

Rank tolerance.

Value

Named list: x, rank_A, rank_Ab, consistent, kind, rss.

References

Golub, G. H. & Van Loan, C. F. (2013). Matrix Computations, sec. 5.3.

Examples

linsys(matrix(c(2, 1, -1, -3, -1, 2, -2, 1, 2), 3, byrow = TRUE), c(8, -11, -3))$x
#> [1]  2  3 -1