diag#

swordfish.function.diag()#

If X is a vector, return a diagonal matrix.

If X is a square matrix, return a vector with the diagonal elements of the matrix.

参数:

X (Constant) -- A numeric vector or a square matrix.