zeroRow := function(n) local row, rowEntry; row := []; for rowEntry in [1..n] do Add(row, 0); od; return row; end; idMatrixRow := function(n, i) local row; row := zeroRow(n); row[i] := 1; return row; end; zeroMatrix := function(n) local matrix, row, rowNumber; row := zeroRow(n); matrix := []; for rowNumber in [1..n] do Add( matrix, row); od; return matrix; end; lambdaMatrix := function(n) # Initialize a matrix with 1's on the diagonal and -1's # on the subdiagonal. local matrix, row, rowNumber; matrix := []; Add( matrix, idMatrixRow( n, 1 ) ); for rowNumber in [2..n] do row := idMatrixRow( n, rowNumber ); row[ rowNumber - 1 ] := -1; Add(matrix, row); od; return matrix; end; addBlock:= function( V, M, iPut, jPut ) # Add the values of M to the block of V with upper # left corner (iPut, jPut). local i, j, row, mRows, mColumns; mRows := Size(M); mColumns := Size(M[1]); for i in [iPut..iPut + mRows - 1] do row := zeroRow(Size(V)); for j in [1..Size(V)] do row[j] := V[i][j]; od; for j in [0..mColumns-1] do row[jPut + j] := row[jPut + j] + M[i - iPut + 1][j + 1]; od; V[i] := row; od; end;