Creates a matrix from only the diagonal entries of a matrix.