def _errors_and_values_helper(self, alpha, y, v, Q, QT_y):
        w = 1.0 / (v + alpha)
        c = np.dot(Q, self._diag_dot(w, QT_y))
        G_diag = self._decomp_diag(w, Q)
        # handle case where y is 2-d
        if len(y.shape) != 1:
            G_diag = G_diag[:, np.newaxis]
        return G_diag, c
Helper function to avoid code duplication between self._errors and
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/linear_model/ridge.py/_RidgeGCV._errors_and_values_helper