Given an input matrix, diag2vec returns a column vector of the elements along the diagonal.
Usage
diag2vec(x)
Arguments
x
an input matrix.
Details
Similar to the function diag, except that the input argument is always
treated as a matrix (i.e., it doesn't have diag()'s functions of returning an Identity matrix from an nrow specification, nor to return
a matrix wrapped around a diagonal if provided with a vector). To get vector2matrix functionality, call vec2diag.