'A generator that yields the element-wise derivative of the
marginal covariance matrix with respect to the random effects
variance and covariance parameters.
ex_r : array-like
The random effects design matrix
solver : function
A function that given x returns V^{-1}x, where V
is the group\'s marginal covariance matrix.
group : scalar
The group label
max_ix : integer or None
If not None, the generator ends when this index
is reached.'

def _gen_dV_dPar(self, ex_r, solver, group, max_ix=None):

    axr = solver(ex_r)
    jj = 0
    for j1 in range(self.k_re):
        for j2 in range((j1 + 1)):
            if ((max_ix is not None) and (jj > max_ix)):
                return
            (mat_l, mat_r) = (ex_r[:, j1:(j1 + 1)], ex_r[:, j2:(j2 + 1)])
            (vsl, vsr) = (axr[:, j1:(j1 + 1)], axr[:, j2:(j2 + 1)])
            (yield (jj, mat_l, mat_r, vsl, vsr, (j1 == j2)))
            jj += 1
    for ky in self._vc_names:
        if (group in self.exog_vc[ky]):
            if ((max_ix is not None) and (jj > max_ix)):
                return
            mat = self.exog_vc[ky][group]
            axmat = solver(mat)
            (yield (jj, mat, mat, axmat, axmat, True))
            jj += 1
