Is there an easy way to extract the elements of the main diagonal to a vector? This would basically be the inverse of the diag(x) operation.