Description
An attempt is made to coerce the ring elements and matrices to a common ring. If the entries are ring elements, they are used as the entries of the matrix, and if the entries are matrices, then they are used to provide blocks of entries in the resulting matrix.
An attempt is made to set up the degrees of the generators of the free module serving as source so that the map will be homogeneous and of degree zero.
i1 : R = ZZ/101[x,y,z]
o1 = R
o1 : PolynomialRing

i2 : p = matrix {{x,y,z}}
o2 =  x y z 
1 3
o2 : Matrix R < R

i3 : degrees source p
o3 = {{1}, {1}, {1}}
o3 : List

i4 : isHomogeneous p
o4 = true

Notice that the degrees were set up so that p is homogeneous, because the source module is not explicitly specified by the user. The next example involves block matrices.
i5 : q = vars R
o5 =  x y z 
1 3
o5 : Matrix R < R

i6 : matrix {{q,q,q}}
o6 =  x y z x y z x y z 
1 9
o6 : Matrix R < R

i7 : matrix {{q},{q},{q}}
o7 =  x y z 
 x y z 
 x y z 
3 3
o7 : Matrix R < R

Here we construct a matrix from column vectors.
i8 : F = R^3
3
o8 = R
o8 : Rmodule, free

i9 : matrix {F_2, F_1, x*F_0 + y*F_1 + z*F_2}
o9 =  0 0 x 
 0 1 y 
 1 0 z 
3 3
o9 : Matrix R < R
