Does first step in algorithm should look like following?
// find the element with largest absolute value in col p and below row p-1
So instead of all col p just part of it.
Algorithm:
for p = 1 to n do
// find the element with largest absolute value in col p <-first step
// if max is zero, stop!
// if max element not in row p, swap rows
// set pivot element to 1
multiply row p by 1/A[p][p]
// clear lower column entries
for r = p+1 to n do
subtract row p times A[r,p] from current row,
so that element in pivot column becomes 0
// do backwards substitution
for row = n-1 to 1
for col = row+1 to n
// subtract out known quantities
b[row] = b[row] - A[row][col]*b[col]
EDIT:
We have matrix A. Algorithm starts from first step with p=3. My question is: should I choose largest element from {5,3,2,-1} (all elements od col p) or {2,-1} (only elements from col p which are below row p-1)?
[1 2 5 3]
[0 1 3 4]
[0 0 2 2] = A
[0 0 -1 1]