let rec pivot ro matrix start_row row col =
if lookup ro matrix row col = 1 then
begin
if start_row <> row then
swap_lines ro start_row row;
true
end
else
begin
if row < (Array.length matrix)-1 then
pivot ro matrix start_row (row+1) col
else
false
end