Pooh program example 03-matrix-mult.p

Test 03-matrix-mult.p

Source of programm

# test work with two dimensional matrixes.

a = [
       [ 1, 2, 3, 4 ],
       [ 5, 6, 7, 8 ],
       [ 9, 0, 1, 2 ],
       [ 3, 4, 5, 6 ]
    ]

c = make_identity_matrix( ~rows 4 ~cols 4 )
print_matrix( ~matrix c )

println( ~msg 'matrix a' )
print_matrix( ~matrix a )

matrix_scale( ~factor 2 ~matrix a )
println( ~msg 'scale a by 2' )
print_matrix( ~matrix a )

println( ~msg 'matrix b' )
b = make_upper_triangle( ~rows 4 ~cols 4 )
print_matrix( ~matrix b )

d = matrix_mult( ~leftm a  ~rightm b )
println( ~msg 'product of matrix a and b' )
print_matrix( ~matrix d )


sub matrix_scale( factor, matrix )
  
  numrows = size( ~arg matrix )
  numcols = size( ~arg matrix[ 1 ] )


  for i range( ~from 1 ~to numrows )
    for j range( ~from 1 ~to numcols )
       matrix[i][j] = factor * matrix[ i ] [ j ]
    end
  end
end

sub matrix_mult( leftm, rightm )
  
  numleftrows = size( ~arg leftm )
  numleftcols = size( ~arg leftm[ 1 ] )

  numrightrows = size( ~arg rightm )
  numrightcols = size( ~arg rightm[ 1 ] )

  if numleftcols != numrightrows 
    return []
  end

  c = []

  for left_row range( ~from 1 ~to numleftrows )
    for right_col range( ~from 1 ~to numrightcols )

       s = 0
       for n range( ~from 1 ~to numleftcols )
         s = s + leftm[ left_row ] [ n ] * rightm[ n ] [ right_col ]
       end
       c[ left_row ] [ right_col ] = s 
    end
  end
  return c
end


sub print_matrix( matrix )
  
   numrows = size( ~arg matrix )
   numcols = size( ~arg matrix[ 1 ] )

   for i range( ~from 1 ~to numrows )
     for j range( ~from 1 ~to numcols )
        print( ~msg matrix[i][j] .. ' ' )
     end
     println( ~msg ' ') 
   end
end


sub make_upper_triangle( rows, cols )
   c = []
   for i range( ~from 1 ~to rows )
     for j range( ~from 1 ~to cols )
       if i <= j
         c[ i ] [ j ] = 1
       else 
         c[ i ] [ j ] = 0
       end
     end
   end
   return c
end

sub make_identity_matrix( rows, cols )
   c = []
   for i range( ~from 1 ~to rows )
     for j range( ~from 1 ~to cols )
       if i == j 
         c[ i ] [ j ] = 1
       else 
         c[ i ] [ j ] = 0
       end
     end
   end
   return c
end

Standard output for 03-matrix-mult.p

1 0 0 0  
0 1 0 0  
0 0 1 0  
0 0 0 1  
matrix a
1 2 3 4  
5 6 7 8  
9 0 1 2  
3 4 5 6  
scale a by 2
2 4 6 8  
10 12 14 16  
18 0 2 4  
6 8 10 12  
matrix b
1 1 1 1  
0 1 1 1  
0 0 1 1  
0 0 0 1  
product of matrix a and b
2 6 12 20  
10 22 36 52  
18 18 20 24  
6 14 24 36  

Trace output for 03-matrix-mult.p

003|a = [ [ 1 , 2 , 3 , 4]  , [ 5 , 6 , 7 , 8]  , [ 9 , 0 , 1 , 2]  , [ 3 , 4 , 5 , 6] ] 
010|... = make_identity_matrix( ~rows 4 ~cols 4 )...
099| c = [ ] 
100| for ... range( ~from 1 ~to rows:4 )...
100|  for i = 1
101|   for ... range( ~from 1 ~to cols:4 )...
101|    for j = 1
102|     if (i:1 == j:1):true
103|      c[i:1][j:1]:1 = 1
103|     end # if
101|    end
101|    for ...
101|    for j = 2
102|     if (i:1 == j:2):false
103|     else
105|      c[i:1][j:2]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    for j = 3
102|     if (i:1 == j:3):false
103|     else
105|      c[i:1][j:3]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    for j = 4
102|     if (i:1 == j:4):false
103|     else
105|      c[i:1][j:4]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    end # finish for loop
100|  end
100|  for ...
100|  for i = 2
101|   for ... range( ~from 1 ~to cols:4 )...
101|    for j = 1
102|     if (i:2 == j:1):false
103|     else
105|      c[i:2][j:1]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    for j = 2
102|     if (i:2 == j:2):true
103|      c[i:2][j:2]:1 = 1
103|     end # if
101|    end
101|    for ...
101|    for j = 3
102|     if (i:2 == j:3):false
103|     else
105|      c[i:2][j:3]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    for j = 4
102|     if (i:2 == j:4):false
103|     else
105|      c[i:2][j:4]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    end # finish for loop
100|  end
100|  for ...
100|  for i = 3
101|   for ... range( ~from 1 ~to cols:4 )...
101|    for j = 1
102|     if (i:3 == j:1):false
103|     else
105|      c[i:3][j:1]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    for j = 2
102|     if (i:3 == j:2):false
103|     else
105|      c[i:3][j:2]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    for j = 3
102|     if (i:3 == j:3):true
103|      c[i:3][j:3]:1 = 1
103|     end # if
101|    end
101|    for ...
101|    for j = 4
102|     if (i:3 == j:4):false
103|     else
105|      c[i:3][j:4]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    end # finish for loop
100|  end
100|  for ...
100|  for i = 4
101|   for ... range( ~from 1 ~to cols:4 )...
101|    for j = 1
102|     if (i:4 == j:1):false
103|     else
105|      c[i:4][j:1]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    for j = 2
102|     if (i:4 == j:2):false
103|     else
105|      c[i:4][j:2]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    for j = 3
102|     if (i:4 == j:3):false
103|     else
105|      c[i:4][j:3]:0 = 0
105|     end # if
101|    end
101|    for ...
101|    for j = 4
102|     if (i:4 == j:4):true
103|      c[i:4][j:4]:1 = 1
103|     end # if
101|    end
101|    for ...
101|    end # finish for loop
100|  end
100|  for ...
100|  end # finish for loop
109|  return c:[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]
010|c = make_identity_matrix( ~rows 4 ~cols 4 ):[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]
011|print_matrix( ~matrix c:[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ] )...
072| ... = size( ~arg matrix:-> [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ] )...
072| numrows = size( ~arg matrix:-> [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ] ):4
073| ... = size( ~arg matrix[1]:[ 1, 0, 0, 0 ] )...
073| numcols = size( ~arg matrix[1]:[ 1, 0, 0, 0 ] ):4
075| for ... range( ~from 1 ~to numrows:4 )...
075|  for i = 1
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:1][j:1]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:1][j:2]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:1][j:3]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:1][j:4]:0 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 2
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:2][j:1]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:2][j:2]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:2][j:3]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:2][j:4]:0 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 3
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:3][j:1]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:3][j:2]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:3][j:3]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:3][j:4]:0 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 4
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:4][j:1]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:4][j:2]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:4][j:3]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:4][j:4]:1 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  end # finish for loop
013|println( ~msg 'matrix a' )...
014|print_matrix( ~matrix a:[ -> [ -> 1, -> 2, -> 3, -> 4 ], -> [ -> 5, -> 6, -> 7, -> 8 ], -> [ -> 9, -> 0, -> 1, -> 2 ], -> [ -> 3, -> 4, -> 5, -> 6 ] ] )...
072| ... = size( ~arg matrix:-> [ -> [ -> 1, -> 2, -> 3, -> 4 ], -> [ -> 5, -> 6, -> 7, -> 8 ], -> [ -> 9, -> 0, -> 1, -> 2 ], -> [ -> 3, -> 4, -> 5, -> 6 ] ] )...
072| numrows = size( ~arg matrix:-> [ -> [ -> 1, -> 2, -> 3, -> 4 ], -> [ -> 5, -> 6, -> 7, -> 8 ], -> [ -> 9, -> 0, -> 1, -> 2 ], -> [ -> 3, -> 4, -> 5, -> 6 ] ] ):4
073| ... = size( ~arg matrix[1]:[ -> 1, -> 2, -> 3, -> 4 ] )...
073| numcols = size( ~arg matrix[1]:[ -> 1, -> 2, -> 3, -> 4 ] ):4
075| for ... range( ~from 1 ~to numrows:4 )...
075|  for i = 1
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:1][j:1]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:1][j:2]:2 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:1][j:3]:3 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:1][j:4]:4 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 2
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:2][j:1]:5 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:2][j:2]:6 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:2][j:3]:7 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:2][j:4]:8 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 3
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:3][j:1]:9 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:3][j:2]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:3][j:3]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:3][j:4]:2 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 4
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:4][j:1]:3 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:4][j:2]:4 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:4][j:3]:5 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:4][j:4]:6 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  end # finish for loop
016|matrix_scale( ~factor 2 ~matrix a:[ -> [ -> 1, -> 2, -> 3, -> 4 ], -> [ -> 5, -> 6, -> 7, -> 8 ], -> [ -> 9, -> 0, -> 1, -> 2 ], -> [ -> 3, -> 4, -> 5, -> 6 ] ] )...
031| ... = size( ~arg matrix:-> [ -> [ -> 1, -> 2, -> 3, -> 4 ], -> [ -> 5, -> 6, -> 7, -> 8 ], -> [ -> 9, -> 0, -> 1, -> 2 ], -> [ -> 3, -> 4, -> 5, -> 6 ] ] )...
031| numrows = size( ~arg matrix:-> [ -> [ -> 1, -> 2, -> 3, -> 4 ], -> [ -> 5, -> 6, -> 7, -> 8 ], -> [ -> 9, -> 0, -> 1, -> 2 ], -> [ -> 3, -> 4, -> 5, -> 6 ] ] ):4
032| ... = size( ~arg matrix[1]:[ -> 1, -> 2, -> 3, -> 4 ] )...
032| numcols = size( ~arg matrix[1]:[ -> 1, -> 2, -> 3, -> 4 ] ):4
035| for ... range( ~from 1 ~to numrows:4 )...
035|  for i = 1
036|   for ... range( ~from 1 ~to numcols:4 )...
036|    for j = 1
037|     matrix[i:1][j:1]:2 = (factor:2 * matrix[i:1][j:1]:1):2
036|    end
036|    for ...
036|    for j = 2
037|     matrix[i:1][j:2]:4 = (factor:2 * matrix[i:1][j:2]:2):4
036|    end
036|    for ...
036|    for j = 3
037|     matrix[i:1][j:3]:6 = (factor:2 * matrix[i:1][j:3]:3):6
036|    end
036|    for ...
036|    for j = 4
037|     matrix[i:1][j:4]:8 = (factor:2 * matrix[i:1][j:4]:4):8
036|    end
036|    for ...
036|    end # finish for loop
035|  end
035|  for ...
035|  for i = 2
036|   for ... range( ~from 1 ~to numcols:4 )...
036|    for j = 1
037|     matrix[i:2][j:1]:10 = (factor:2 * matrix[i:2][j:1]:5):10
036|    end
036|    for ...
036|    for j = 2
037|     matrix[i:2][j:2]:12 = (factor:2 * matrix[i:2][j:2]:6):12
036|    end
036|    for ...
036|    for j = 3
037|     matrix[i:2][j:3]:14 = (factor:2 * matrix[i:2][j:3]:7):14
036|    end
036|    for ...
036|    for j = 4
037|     matrix[i:2][j:4]:16 = (factor:2 * matrix[i:2][j:4]:8):16
036|    end
036|    for ...
036|    end # finish for loop
035|  end
035|  for ...
035|  for i = 3
036|   for ... range( ~from 1 ~to numcols:4 )...
036|    for j = 1
037|     matrix[i:3][j:1]:18 = (factor:2 * matrix[i:3][j:1]:9):18
036|    end
036|    for ...
036|    for j = 2
037|     matrix[i:3][j:2]:0 = (factor:2 * matrix[i:3][j:2]:0):0
036|    end
036|    for ...
036|    for j = 3
037|     matrix[i:3][j:3]:2 = (factor:2 * matrix[i:3][j:3]:1):2
036|    end
036|    for ...
036|    for j = 4
037|     matrix[i:3][j:4]:4 = (factor:2 * matrix[i:3][j:4]:2):4
036|    end
036|    for ...
036|    end # finish for loop
035|  end
035|  for ...
035|  for i = 4
036|   for ... range( ~from 1 ~to numcols:4 )...
036|    for j = 1
037|     matrix[i:4][j:1]:6 = (factor:2 * matrix[i:4][j:1]:3):6
036|    end
036|    for ...
036|    for j = 2
037|     matrix[i:4][j:2]:8 = (factor:2 * matrix[i:4][j:2]:4):8
036|    end
036|    for ...
036|    for j = 3
037|     matrix[i:4][j:3]:10 = (factor:2 * matrix[i:4][j:3]:5):10
036|    end
036|    for ...
036|    for j = 4
037|     matrix[i:4][j:4]:12 = (factor:2 * matrix[i:4][j:4]:6):12
036|    end
036|    for ...
036|    end # finish for loop
035|  end
035|  for ...
035|  end # finish for loop
017|println( ~msg 'scale a by 2' )...
018|print_matrix( ~matrix a:[ -> [ -> 2, -> 4, -> 6, -> 8 ], -> [ -> 10, -> 12, -> 14, -> 16 ], -> [ -> 18, -> 0, -> 2, -> 4 ], -> [ -> 6, -> 8, -> 10, -> 12 ] ] )...
072| ... = size( ~arg matrix:-> [ -> [ -> 2, -> 4, -> 6, -> 8 ], -> [ -> 10, -> 12, -> 14, -> 16 ], -> [ -> 18, -> 0, -> 2, -> 4 ], -> [ -> 6, -> 8, -> 10, -> 12 ] ] )...
072| numrows = size( ~arg matrix:-> [ -> [ -> 2, -> 4, -> 6, -> 8 ], -> [ -> 10, -> 12, -> 14, -> 16 ], -> [ -> 18, -> 0, -> 2, -> 4 ], -> [ -> 6, -> 8, -> 10, -> 12 ] ] ):4
073| ... = size( ~arg matrix[1]:[ -> 2, -> 4, -> 6, -> 8 ] )...
073| numcols = size( ~arg matrix[1]:[ -> 2, -> 4, -> 6, -> 8 ] ):4
075| for ... range( ~from 1 ~to numrows:4 )...
075|  for i = 1
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:1][j:1]:2 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:1][j:2]:4 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:1][j:3]:6 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:1][j:4]:8 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 2
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:2][j:1]:10 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:2][j:2]:12 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:2][j:3]:14 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:2][j:4]:16 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 3
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:3][j:1]:18 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:3][j:2]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:3][j:3]:2 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:3][j:4]:4 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 4
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:4][j:1]:6 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:4][j:2]:8 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:4][j:3]:10 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:4][j:4]:12 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  end # finish for loop
020|println( ~msg 'matrix b' )...
021|... = make_upper_triangle( ~rows 4 ~cols 4 )...
085| c = [ ] 
086| for ... range( ~from 1 ~to rows:4 )...
086|  for i = 1
087|   for ... range( ~from 1 ~to cols:4 )...
087|    for j = 1
088|     if (i:1 <= j:1):true
089|      c[i:1][j:1]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    for j = 2
088|     if (i:1 <= j:2):true
089|      c[i:1][j:2]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    for j = 3
088|     if (i:1 <= j:3):true
089|      c[i:1][j:3]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    for j = 4
088|     if (i:1 <= j:4):true
089|      c[i:1][j:4]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    end # finish for loop
086|  end
086|  for ...
086|  for i = 2
087|   for ... range( ~from 1 ~to cols:4 )...
087|    for j = 1
088|     if (i:2 <= j:1):false
089|     else
091|      c[i:2][j:1]:0 = 0
091|     end # if
087|    end
087|    for ...
087|    for j = 2
088|     if (i:2 <= j:2):true
089|      c[i:2][j:2]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    for j = 3
088|     if (i:2 <= j:3):true
089|      c[i:2][j:3]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    for j = 4
088|     if (i:2 <= j:4):true
089|      c[i:2][j:4]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    end # finish for loop
086|  end
086|  for ...
086|  for i = 3
087|   for ... range( ~from 1 ~to cols:4 )...
087|    for j = 1
088|     if (i:3 <= j:1):false
089|     else
091|      c[i:3][j:1]:0 = 0
091|     end # if
087|    end
087|    for ...
087|    for j = 2
088|     if (i:3 <= j:2):false
089|     else
091|      c[i:3][j:2]:0 = 0
091|     end # if
087|    end
087|    for ...
087|    for j = 3
088|     if (i:3 <= j:3):true
089|      c[i:3][j:3]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    for j = 4
088|     if (i:3 <= j:4):true
089|      c[i:3][j:4]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    end # finish for loop
086|  end
086|  for ...
086|  for i = 4
087|   for ... range( ~from 1 ~to cols:4 )...
087|    for j = 1
088|     if (i:4 <= j:1):false
089|     else
091|      c[i:4][j:1]:0 = 0
091|     end # if
087|    end
087|    for ...
087|    for j = 2
088|     if (i:4 <= j:2):false
089|     else
091|      c[i:4][j:2]:0 = 0
091|     end # if
087|    end
087|    for ...
087|    for j = 3
088|     if (i:4 <= j:3):false
089|     else
091|      c[i:4][j:3]:0 = 0
091|     end # if
087|    end
087|    for ...
087|    for j = 4
088|     if (i:4 <= j:4):true
089|      c[i:4][j:4]:1 = 1
089|     end # if
087|    end
087|    for ...
087|    end # finish for loop
086|  end
086|  for ...
086|  end # finish for loop
095|  return c:[ [ 1, 1, 1, 1 ], [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 0, 1 ] ]
021|b = make_upper_triangle( ~rows 4 ~cols 4 ):[ [ 1, 1, 1, 1 ], [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 0, 1 ] ]
022|print_matrix( ~matrix b:[ [ 1, 1, 1, 1 ], [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 0, 1 ] ] )...
072| ... = size( ~arg matrix:-> [ [ 1, 1, 1, 1 ], [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 0, 1 ] ] )...
072| numrows = size( ~arg matrix:-> [ [ 1, 1, 1, 1 ], [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 0, 1 ] ] ):4
073| ... = size( ~arg matrix[1]:[ 1, 1, 1, 1 ] )...
073| numcols = size( ~arg matrix[1]:[ 1, 1, 1, 1 ] ):4
075| for ... range( ~from 1 ~to numrows:4 )...
075|  for i = 1
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:1][j:1]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:1][j:2]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:1][j:3]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:1][j:4]:1 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 2
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:2][j:1]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:2][j:2]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:2][j:3]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:2][j:4]:1 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 3
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:3][j:1]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:3][j:2]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:3][j:3]:1 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:3][j:4]:1 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 4
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:4][j:1]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:4][j:2]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:4][j:3]:0 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:4][j:4]:1 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  end # finish for loop
024|... = matrix_mult( ~leftm a:[ -> [ -> 2, -> 4, -> 6, -> 8 ], -> [ -> 10, -> 12, -> 14, -> 16 ], -> [ -> 18, -> 0, -> 2, -> 4 ], -> [ -> 6, -> 8, -> 10, -> 12 ] ] ~rightm b:[ [ 1, 1, 1, 1 ], [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 0, 1 ] ] )...
044| ... = size( ~arg leftm:-> [ -> [ -> 2, -> 4, -> 6, -> 8 ], -> [ -> 10, -> 12, -> 14, -> 16 ], -> [ -> 18, -> 0, -> 2, -> 4 ], -> [ -> 6, -> 8, -> 10, -> 12 ] ] )...
044| numleftrows = size( ~arg leftm:-> [ -> [ -> 2, -> 4, -> 6, -> 8 ], -> [ -> 10, -> 12, -> 14, -> 16 ], -> [ -> 18, -> 0, -> 2, -> 4 ], -> [ -> 6, -> 8, -> 10, -> 12 ] ] ):4
045| ... = size( ~arg leftm[1]:[ -> 2, -> 4, -> 6, -> 8 ] )...
045| numleftcols = size( ~arg leftm[1]:[ -> 2, -> 4, -> 6, -> 8 ] ):4
047| ... = size( ~arg rightm:-> [ [ 1, 1, 1, 1 ], [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 0, 1 ] ] )...
047| numrightrows = size( ~arg rightm:-> [ [ 1, 1, 1, 1 ], [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 0, 1 ] ] ):4
048| ... = size( ~arg rightm[1]:[ 1, 1, 1, 1 ] )...
048| numrightcols = size( ~arg rightm[1]:[ 1, 1, 1, 1 ] ):4
050| if (numleftcols:4 != numrightrows:4):false
051| end # if
054| c = [ ] 
056| for ... range( ~from 1 ~to numleftrows:4 )...
056|  for left_row = 1
057|   for ... range( ~from 1 ~to numrightcols:4 )...
057|    for right_col = 1
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:1][n:1]:2 * rightm[n:1][right_col:1]:1):2):2
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:2 + (leftm[left_row:1][n:2]:4 * rightm[n:2][right_col:1]:0):0):2
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:2 + (leftm[left_row:1][n:3]:6 * rightm[n:3][right_col:1]:0):0):2
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:2 + (leftm[left_row:1][n:4]:8 * rightm[n:4][right_col:1]:0):0):2
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:1][right_col:1]:2 = s:2
057|    end
057|    for ...
057|    for right_col = 2
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:1][n:1]:2 * rightm[n:1][right_col:2]:1):2):2
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:2 + (leftm[left_row:1][n:2]:4 * rightm[n:2][right_col:2]:1):4):6
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:6 + (leftm[left_row:1][n:3]:6 * rightm[n:3][right_col:2]:0):0):6
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:6 + (leftm[left_row:1][n:4]:8 * rightm[n:4][right_col:2]:0):0):6
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:1][right_col:2]:6 = s:6
057|    end
057|    for ...
057|    for right_col = 3
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:1][n:1]:2 * rightm[n:1][right_col:3]:1):2):2
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:2 + (leftm[left_row:1][n:2]:4 * rightm[n:2][right_col:3]:1):4):6
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:6 + (leftm[left_row:1][n:3]:6 * rightm[n:3][right_col:3]:1):6):12
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:12 + (leftm[left_row:1][n:4]:8 * rightm[n:4][right_col:3]:0):0):12
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:1][right_col:3]:12 = s:12
057|    end
057|    for ...
057|    for right_col = 4
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:1][n:1]:2 * rightm[n:1][right_col:4]:1):2):2
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:2 + (leftm[left_row:1][n:2]:4 * rightm[n:2][right_col:4]:1):4):6
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:6 + (leftm[left_row:1][n:3]:6 * rightm[n:3][right_col:4]:1):6):12
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:12 + (leftm[left_row:1][n:4]:8 * rightm[n:4][right_col:4]:1):8):20
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:1][right_col:4]:20 = s:20
057|    end
057|    for ...
057|    end # finish for loop
056|  end
056|  for ...
056|  for left_row = 2
057|   for ... range( ~from 1 ~to numrightcols:4 )...
057|    for right_col = 1
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:2][n:1]:10 * rightm[n:1][right_col:1]:1):10):10
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:10 + (leftm[left_row:2][n:2]:12 * rightm[n:2][right_col:1]:0):0):10
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:10 + (leftm[left_row:2][n:3]:14 * rightm[n:3][right_col:1]:0):0):10
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:10 + (leftm[left_row:2][n:4]:16 * rightm[n:4][right_col:1]:0):0):10
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:2][right_col:1]:10 = s:10
057|    end
057|    for ...
057|    for right_col = 2
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:2][n:1]:10 * rightm[n:1][right_col:2]:1):10):10
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:10 + (leftm[left_row:2][n:2]:12 * rightm[n:2][right_col:2]:1):12):22
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:22 + (leftm[left_row:2][n:3]:14 * rightm[n:3][right_col:2]:0):0):22
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:22 + (leftm[left_row:2][n:4]:16 * rightm[n:4][right_col:2]:0):0):22
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:2][right_col:2]:22 = s:22
057|    end
057|    for ...
057|    for right_col = 3
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:2][n:1]:10 * rightm[n:1][right_col:3]:1):10):10
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:10 + (leftm[left_row:2][n:2]:12 * rightm[n:2][right_col:3]:1):12):22
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:22 + (leftm[left_row:2][n:3]:14 * rightm[n:3][right_col:3]:1):14):36
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:36 + (leftm[left_row:2][n:4]:16 * rightm[n:4][right_col:3]:0):0):36
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:2][right_col:3]:36 = s:36
057|    end
057|    for ...
057|    for right_col = 4
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:2][n:1]:10 * rightm[n:1][right_col:4]:1):10):10
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:10 + (leftm[left_row:2][n:2]:12 * rightm[n:2][right_col:4]:1):12):22
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:22 + (leftm[left_row:2][n:3]:14 * rightm[n:3][right_col:4]:1):14):36
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:36 + (leftm[left_row:2][n:4]:16 * rightm[n:4][right_col:4]:1):16):52
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:2][right_col:4]:52 = s:52
057|    end
057|    for ...
057|    end # finish for loop
056|  end
056|  for ...
056|  for left_row = 3
057|   for ... range( ~from 1 ~to numrightcols:4 )...
057|    for right_col = 1
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:3][n:1]:18 * rightm[n:1][right_col:1]:1):18):18
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:18 + (leftm[left_row:3][n:2]:0 * rightm[n:2][right_col:1]:0):0):18
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:18 + (leftm[left_row:3][n:3]:2 * rightm[n:3][right_col:1]:0):0):18
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:18 + (leftm[left_row:3][n:4]:4 * rightm[n:4][right_col:1]:0):0):18
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:3][right_col:1]:18 = s:18
057|    end
057|    for ...
057|    for right_col = 2
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:3][n:1]:18 * rightm[n:1][right_col:2]:1):18):18
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:18 + (leftm[left_row:3][n:2]:0 * rightm[n:2][right_col:2]:1):0):18
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:18 + (leftm[left_row:3][n:3]:2 * rightm[n:3][right_col:2]:0):0):18
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:18 + (leftm[left_row:3][n:4]:4 * rightm[n:4][right_col:2]:0):0):18
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:3][right_col:2]:18 = s:18
057|    end
057|    for ...
057|    for right_col = 3
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:3][n:1]:18 * rightm[n:1][right_col:3]:1):18):18
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:18 + (leftm[left_row:3][n:2]:0 * rightm[n:2][right_col:3]:1):0):18
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:18 + (leftm[left_row:3][n:3]:2 * rightm[n:3][right_col:3]:1):2):20
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:20 + (leftm[left_row:3][n:4]:4 * rightm[n:4][right_col:3]:0):0):20
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:3][right_col:3]:20 = s:20
057|    end
057|    for ...
057|    for right_col = 4
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:3][n:1]:18 * rightm[n:1][right_col:4]:1):18):18
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:18 + (leftm[left_row:3][n:2]:0 * rightm[n:2][right_col:4]:1):0):18
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:18 + (leftm[left_row:3][n:3]:2 * rightm[n:3][right_col:4]:1):2):20
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:20 + (leftm[left_row:3][n:4]:4 * rightm[n:4][right_col:4]:1):4):24
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:3][right_col:4]:24 = s:24
057|    end
057|    for ...
057|    end # finish for loop
056|  end
056|  for ...
056|  for left_row = 4
057|   for ... range( ~from 1 ~to numrightcols:4 )...
057|    for right_col = 1
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:4][n:1]:6 * rightm[n:1][right_col:1]:1):6):6
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:6 + (leftm[left_row:4][n:2]:8 * rightm[n:2][right_col:1]:0):0):6
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:6 + (leftm[left_row:4][n:3]:10 * rightm[n:3][right_col:1]:0):0):6
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:6 + (leftm[left_row:4][n:4]:12 * rightm[n:4][right_col:1]:0):0):6
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:4][right_col:1]:6 = s:6
057|    end
057|    for ...
057|    for right_col = 2
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:4][n:1]:6 * rightm[n:1][right_col:2]:1):6):6
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:6 + (leftm[left_row:4][n:2]:8 * rightm[n:2][right_col:2]:1):8):14
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:14 + (leftm[left_row:4][n:3]:10 * rightm[n:3][right_col:2]:0):0):14
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:14 + (leftm[left_row:4][n:4]:12 * rightm[n:4][right_col:2]:0):0):14
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:4][right_col:2]:14 = s:14
057|    end
057|    for ...
057|    for right_col = 3
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:4][n:1]:6 * rightm[n:1][right_col:3]:1):6):6
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:6 + (leftm[left_row:4][n:2]:8 * rightm[n:2][right_col:3]:1):8):14
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:14 + (leftm[left_row:4][n:3]:10 * rightm[n:3][right_col:3]:1):10):24
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:24 + (leftm[left_row:4][n:4]:12 * rightm[n:4][right_col:3]:0):0):24
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:4][right_col:3]:24 = s:24
057|    end
057|    for ...
057|    for right_col = 4
059|     s = 0
060|     for ... range( ~from 1 ~to numleftcols:4 )...
060|      for n = 1
061|       s = (s:0 + (leftm[left_row:4][n:1]:6 * rightm[n:1][right_col:4]:1):6):6
060|      end
060|      for ...
060|      for n = 2
061|       s = (s:6 + (leftm[left_row:4][n:2]:8 * rightm[n:2][right_col:4]:1):8):14
060|      end
060|      for ...
060|      for n = 3
061|       s = (s:14 + (leftm[left_row:4][n:3]:10 * rightm[n:3][right_col:4]:1):10):24
060|      end
060|      for ...
060|      for n = 4
061|       s = (s:24 + (leftm[left_row:4][n:4]:12 * rightm[n:4][right_col:4]:1):12):36
060|      end
060|      for ...
060|      end # finish for loop
063|      c[left_row:4][right_col:4]:36 = s:36
057|    end
057|    for ...
057|    end # finish for loop
056|  end
056|  for ...
056|  end # finish for loop
066|  return c:[ [ 2, 6, 12, 20 ], [ 10, 22, 36, 52 ], [ 18, 18, 20, 24 ], [ 6, 14, 24, 36 ] ]
024|d = matrix_mult( ~leftm a:[ -> [ -> 2, -> 4, -> 6, -> 8 ], -> [ -> 10, -> 12, -> 14, -> 16 ], -> [ -> 18, -> 0, -> 2, -> 4 ], -> [ -> 6, -> 8, -> 10, -> 12 ] ] ~rightm b:[ [ 1, 1, 1, 1 ], [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 0, 1 ] ] ):[ [ 2, 6, 12, 20 ], [ 10, 22, 36, 52 ], [ 18, 18, 20, 24 ], [ 6, 14, 24, 36 ] ]
025|println( ~msg 'product of matrix a and b' )...
026|print_matrix( ~matrix d:[ [ 2, 6, 12, 20 ], [ 10, 22, 36, 52 ], [ 18, 18, 20, 24 ], [ 6, 14, 24, 36 ] ] )...
072| ... = size( ~arg matrix:-> [ [ 2, 6, 12, 20 ], [ 10, 22, 36, 52 ], [ 18, 18, 20, 24 ], [ 6, 14, 24, 36 ] ] )...
072| numrows = size( ~arg matrix:-> [ [ 2, 6, 12, 20 ], [ 10, 22, 36, 52 ], [ 18, 18, 20, 24 ], [ 6, 14, 24, 36 ] ] ):4
073| ... = size( ~arg matrix[1]:[ 2, 6, 12, 20 ] )...
073| numcols = size( ~arg matrix[1]:[ 2, 6, 12, 20 ] ):4
075| for ... range( ~from 1 ~to numrows:4 )...
075|  for i = 1
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:1][j:1]:2 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:1][j:2]:6 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:1][j:3]:12 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:1][j:4]:20 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 2
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:2][j:1]:10 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:2][j:2]:22 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:2][j:3]:36 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:2][j:4]:52 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 3
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:3][j:1]:18 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:3][j:2]:18 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:3][j:3]:20 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:3][j:4]:24 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  for i = 4
076|   for ... range( ~from 1 ~to numcols:4 )...
076|    for j = 1
077|     print( ~msg matrix[i:4][j:1]:6 .. ' ' )...

076|    end
076|    for ...
076|    for j = 2
077|     print( ~msg matrix[i:4][j:2]:14 .. ' ' )...

076|    end
076|    for ...
076|    for j = 3
077|     print( ~msg matrix[i:4][j:3]:24 .. ' ' )...

076|    end
076|    for ...
076|    for j = 4
077|     print( ~msg matrix[i:4][j:4]:36 .. ' ' )...

076|    end
076|    for ...
076|    end # finish for loop
079|    println( ~msg ' ' )...
075|  end
075|  for ...
075|  end # finish for loop