Question: Problem with procedure

hi,

i'm trying to figure out where i did a mistake by coding reducedEchelonForm.

with(LinearAlgebra):
reduced:=proc(M)
 local l:=1, m:=RowDimension(M),n:=ColumnDimension(M),i,j; # l current column
 for i from 1 to m do # going trough every row item
  if n<l then # ColumnDimension need to be bigger than current column
   return M;
  end if;
 j:=i; # given current row item
 while M[j,l]=0 do # search for first rom item unequal zero
  j:=j+1;
  if m<j then # end of row
   j=i;
   l=l+1;
   if n<l then # end of rows and columns -> finish
    return M;
  end if;
 end if;
end do;
M:= perm(m,n,j,i).M; #permute row j and i
if not(M[i,l]=0) then # multiply row i with M[i,l])^(-1)
 M:= multiplikation(m,n,i,(M[i,l])^(-1)).M;
end if;
for j from 1 to m do # subtract every row j with row i for M[j,l]-times
 if not(j=i) then
  M:= addition(m,n,j,i,-M[j,l]).M;
 end if;
end do;
l:=l+1; # increase l by 1, next iteration i increase either
end do;
end proc:

 

Hint: perm(...),multiplikation(...) and addition(...) are the elementary matrices. They are working.

 

Now i got an error by running it: 

L:=Matrix(2,3,[1,2,3,4,5,6]);
reduced(L);
Error, (in reduced) invalid left hand side in assignment

Can someone explain me these error? And maybe a hint what i need to fix in my code?

Greets felix

Please Wait...