Creates a diagonal matrix from a 1-D array.
Arguments
- x
(
arrayish)
One input, a 1-D array of lengthnwhose elements become the diagonal entries. Can be any data type. An R value materializes at its default data type.
Value
(arrayish)
Has the input's data type and shape (n, n), with the input on the
diagonal and zeros elsewhere.