If given a matrix, diag returns a sequence of its diagonal elements.
If given a sequence, it returns a matrix with the sequence's elements
on its diagonal. Equivalent to R's diag function.
Examples:
(diag [1 2 3 4])
(def A (matrix [[1 2 3]
[4 5 6]
[7 8 9]]))
(diag A)
Comments top
No comments for diag. Log in to add a comment.