0

Diagonalize a vector into a matrix.
Input
A vector, list, array, etc. of integers \$\mathbf{v}\$ of length \$n\$.
Output
A \$n \times n\$ matrix, 2D array, etc. \$A\$ such that for each element \$a_i \in \mathbf{v}\$,
$$
A =
\left( \begin{array}{ccc}
a_1 & 0 & \cdots & 0 \\
0 & a_2 & \cdots & ...