Learn R Programming

lintools (version 0.1.7)

echelon: Reduced row echelon form

Description

Transform the equalities in a system of linear (in)equations or Reduced Row Echelon form (RRE)

Usage

echelon(A, b, neq = nrow(A), nleq = 0, eps = 1e-08)

Value

A list with the following components:

  • A: the A matrix with equalities transformed to RRE form.

  • b: the constant vector corresponding to A

  • neq: the number of equalities in the resulting system.

  • nleq: the number of inequalities of the form a.x <= b. This will only be passed to the output.

Arguments

A

[numeric] matrix

b

[numeric] vector

neq

[numeric] The first neq rows of A, b are treated as equations.

nleq

[numeric] The nleq rows after neq are treated as inequations of the form a.x<=b. All remaining rows are treated as strict inequations of the form a.x<b.

eps

[numeric] Values of magnitude less than eps are considered zero (for the purpose of handling machine rounding errors).

Details

The parameters A, b and neq describe a system of the form Ax<=b, where the first neq rows are equalities. The equalities are transformed to RRE form.

A system of equations is in reduced row echelon form when

  • All zero rows are below the nonzero rows

  • For every row, the leading coefficient (first nonzero from the left) is always right of the leading coefficient of the row above it.

  • The leading coefficient equals 1, and is the only nonzero coefficient in its column.

Examples

Run this code
echelon(
 A = matrix(c(
    1,3,1,
    2,7,3,
    1,5,3,
    1,2,0), byrow=TRUE, nrow=4)
 , b = c(4,-9,1,8)
 , neq=4
)


Run the code above in your browser using DataLab