It is assumed that f and g both have the same target.
i1 : R = ZZ/101[x,y,z] o1 = R o1 : PolynomialRing
i2 : f = matrix {{x,0,0},{0,y,0},{0,0,z}} o2 = {0} | x 0 0 | {0} | 0 y 0 | {0} | 0 0 z | 3 3 o2 : Matrix R <--- R
i3 : f|f|f o3 = {0} | x 0 0 x 0 0 x 0 0 | {0} | 0 y 0 0 y 0 0 y 0 | {0} | 0 0 z 0 0 z 0 0 z | 3 9 o3 : Matrix R <--- R
i4 : 2|f|3 o4 = {0} | 2 0 0 x 0 0 3 0 0 | {0} | 0 2 0 0 y 0 0 3 0 | {0} | 0 0 2 0 0 z 0 0 3 | 3 9 o4 : Matrix R <--- R
See also | and Matrix || Matrix.