'Helper function to avoid code duplication between self._errors and
self._values.
Notes
We don\'t construct matrix G, instead compute action on y & diagonal.'

def _errors_and_values_helper(self, alpha, y, v, Q, QT_y):

    w = (1.0 / (v + alpha))
    constant_column = (np.var(Q, 0) < 1e-12)
    w[constant_column] = 0
    c = np.dot(Q, self._diag_dot(w, QT_y))
    G_diag = self._decomp_diag(w, Q)
    if (len(y.shape) != 1):
        G_diag = G_diag[:, np.newaxis]
    return (G_diag, c)
