Diagonal matrix

Constructs a diagonal matrix.

diagonal_matrix(List | Range | Vector)

Given a list, range or vector L, constructs a diagonal matrix with the elements of L in the diagonal.

diagonal_matrix(Integer, Expression)

Given an integer n and an expression e, constructs a diagonal matrix of dimension n cross times n with coefficients equal to e.