R/api.R
nv_diag.Rd
Creates a diagonal matrix from a 1-D array.
nv_diag(operand)
(arrayish) A 1-D array of length n whose elements become the diagonal entries.
arrayish
n
arrayish An n x n matrix with x on the diagonal and zeros elsewhere.
n x n
x
nv_diag(nv_array(c(1, 2, 3))) #> AnvlArray #> 1 0 0 #> 0 2 0 #> 0 0 3 #> [ CPUf32{3,3} ]