diagonal


function diagonal(x:NumberScalarLike, n:Integer) -> NumberMatrixLike

Construct diagonal matrix, filling the diagonal with a given scalar.

  • x Scalar to assign to diagonal.
  • n Number of rows and columns.

Returns Diagonal matrix.