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. Parameters: X (Constant) – A numeric vector or a square matrix.