Transform a matrix to row echelon form.

refmatrix(m)

rrefmatrix(m)

solvematrix(A, b)

Arguments

m

a matrix

A

a square matrix representing the coefficients of a linear system in solvematrix

b

a vector representing the right-hand side of the linear system in solvematrix

Value

the modified matrix

Details

refmatrix reduces a matrix to row echelon form. This is not a reduced row echelon form, though that can be easily calculated from the diagonal. This function works on non-square matrices.

rrefmatrix returns the reduced row echelon matrix.

solvematrix solves a linear system using rrefmatrix.

See also

Examples

A <- matrix(c(1, 2, -7, -1, -1, 1, 2, 1, 5), 3)
refmatrix(A)
#>      [,1] [,2] [,3]
#> [1,]    1   -1    2
#> [2,]    0    1   -3
#> [3,]    0    0    1