D.3.1.3 diag
............
Procedure from library matrix.lib (see matrix_lib).

Usage:
diag(p,n); p poly, n integer

diag(A); A matrix

Return:
diag(p,n): diagonal matrix, p times unit matrix of size n.

 diag(A) : n*m x n*m diagonal matrix with entries all the entries of
the nxm matrix A, taken from the 1st row, 2nd row etc of A

Example:
LIB "matrix.lib";
ring r = 0,(x,y,z),ds;
print(diag(xy,4));
==> xy,0, 0, 0,
==> 0, xy,0, 0,
==> 0, 0, xy,0,
==> 0, 0, 0, xy
matrix A[3][2] = 1,2,3,4,5,6;
print(A);
==> 1,2,
==> 3,4,
==> 5,6 
print(diag(A));
==> 1,0,0,0,0,0,
==> 0,2,0,0,0,0,
==> 0,0,3,0,0,0,
==> 0,0,0,4,0,0,
==> 0,0,0,0,5,0,
==> 0,0,0,0,0,6 

<font size="-1">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; User manual for <a href="http://www.singular.uni-kl.de/"><i>Singular</i></a> version 2-0-4, October 2002,
generated by <a href="http://www.gnu.org/software/texinfo/"><i>texi2html</i></a>.
</font>

</body>
</html>
