PivotPos
Returns the column index of the first non-zero entry on a matrix row.
Syntax
-
PivotPos(A, n[, ε])
-
A
is a matrix -
n
is a positive integer -
ε
is a positive number
-
Description
If A
is a matrix and n
a valid row index of A
, then PivotPos(A, n, ε)
returns the column index of the first non-zero entry on the n
th row of A
, comparing values against zero using epsilon ε
. If the n
th row consists only of zeros, 0
is returned.
Examples
A ≔ ❨❨5, 1, 2, 3, 4❩, ❨0, 0, 2, 1, 2❩, ❨0, 0, 0, 5, 1❩, ❨0, 0, 0, 0, 0❩❩
⎛5 1 2 3 4⎞ ⎜0 0 2 1 2⎟ ⎜0 0 0 5 1⎟ ⎝0 0 0 0 0⎠
compute(PivotPos(A, n), n, 1, size(A).rows)
1 3 4 0