'Returns the (dense) vector of the diagonal elements.'

@property
def diag(self):

    in_diag = (self.rows == self.cols)
    diag = np.zeros(min(self.n, self.n), dtype=np.float64)
    diag[self.rows[in_diag]] = self.vals[in_diag]
    return diag
