:diag(matrix)
Returns a one-dimensional matrix containing one of a matrix's diagonals. The diagonal returned starts in the upper-left corner and ends in the lower-right corner. This will cause a Dimension Error unless the matrix is a square matrix.
:diag(list) :diag(one-dimensional matrix)
This returns a matrix that has the specified diagonal, and contains zeros in all other positions.
Example[]
diag([1,2,3;4,5,6;7,8,9])
returns[[1,5,9]]
.diag([[1,4]])
returns[[1,0][0,4]]