# diagonalMatrix(Matrix) -- make a diagonal matrix from entries of a matrix

## Synopsis

• Function: diagonalMatrix
• Usage:
diagonalMatrix m
• Inputs:
• m,
• Outputs:
• , a diagonal matrix whose diagonal entries are the entries of m

## Description

 i1 : R = QQ[a..d]; i2 : diagonalMatrix vars R o2 = | a 0 0 0 | | 0 b 0 0 | | 0 0 c 0 | | 0 0 0 d | 4 4 o2 : Matrix R <--- R
If the matrix has more than one row, the first column is placed on the diagonal first, then the second column, etc.
 i3 : diagonalMatrix matrix{{0,2},{4,6}} o3 = | 0 0 0 0 | | 0 4 0 0 | | 0 0 2 0 | | 0 0 0 6 | 4 4 o3 : Matrix ZZ <--- ZZ