def evaluate(self, meanfunc, covfunc, likfunc, x, y, nargout=1):
        if not isinstance(likfunc, lik.Gauss):                  # NOTE: no explicit call to likGauss
            raise Exception ('Exact inference only possible with Gaussian likelihood')
        if not isinstance(covfunc, cov.FITCOfKernel):
            raise Exception('Only covFITC supported.')          # check cov

        diagK,Kuu,Ku = covfunc.getCovMatrix(x=x, mode='train')  # evaluate covariance matrix
        m  = meanfunc.getMean(x)                                # evaluate mean vector
        n, D = x.shape
        nu = Kuu.shape[0]

        sn2   = np.exp(2*likfunc.hyp[0])                         # noise variance of likGauss
        snu2  = 1.e-6*sn2                                        # hard coded inducing inputs noise
        #Luu   = np.linalg.cholesky(Kuu+snu2*np.eye(nu)).T       # Kuu + snu2*I = Luu'*Luu
        Luu   = jitchol(Kuu+snu2*np.eye(nu)).T                   # Kuu + snu2*I = Luu'*Luu
        V     = np.linalg.solve(Luu.T,Ku)                        # V = inv(Luu')*Ku => V'*V = Q        
        
        g_sn2 = diagK + sn2 - np.array([(V*V).sum(axis=0)]).T    # g + sn2 = diag(K) + sn2 - diag(Q)
        #Lu    = np.linalg.cholesky(np.eye(nu) + np.dot(V/np.tile(g_sn2.T,(nu,1)),V.T)).T  # Lu'*Lu=I+V*diag(1/g_sn2)*V'
        Lu    = jitchol(np.eye(nu) + np.dot(old_div(V,np.tile(g_sn2.T,(nu,1))),V.T)).T  # Lu'*Lu=I+V*diag(1/g_sn2)*V'
        r     = old_div((y-m),np.sqrt(g_sn2))
        be    = np.linalg.solve(Lu.T,np.dot(V,old_div(r,np.sqrt(g_sn2))))
        iKuu  = solve_chol(Luu,np.eye(nu))                       # inv(Kuu + snu2*I) = iKuu

        post = postStruct()
        post.alpha = np.linalg.solve(Luu,np.linalg.solve(Lu,be)) # return the posterior parameters
        post.L  = solve_chol(np.dot(Lu,Luu),np.eye(nu)) - iKuu   # Sigma-inv(Kuu)
        post.sW = old_div(np.ones((n,1)),np.sqrt(sn2))                    # unused for FITC prediction  with gp.m

        if nargout>1:                                            # do we want the marginal likelihood
            nlZ = np.log(np.diag(Lu)).sum() + old_div((np.log(g_sn2).sum() + n*np.log(2*np.pi) + np.dot(r.T,r) - np.dot(be.T,be)),2.)
            if nargout>2:                                        # do we want derivatives?
                dnlZ = dnlZStruct(meanfunc, covfunc, likfunc)    # allocate space for derivatives
                al = old_div(r,np.sqrt(g_sn2)) - old_div(np.dot(V.T,np.linalg.solve(Lu,be)),g_sn2) # al = (Kt+sn2*eye(n))\y
                B = np.dot(iKuu,Ku)
                w = np.dot(B,al)
                W = np.linalg.solve(Lu.T,old_div(V,np.tile(g_sn2.T,(nu,1))))
                for ii in range(len(covfunc.hyp)):
                    [ddiagKi,dKuui,dKui] = covfunc.getDerMatrix(x=x, mode='train', der=ii)    # eval cov deriv
                    R = 2.*dKui-np.dot(dKuui,B)
                    v = ddiagKi - np.array([(R*B).sum(axis=0)]).T          # diag part of cov deriv
                    dnlZ.cov[ii] = old_div(( np.dot(ddiagKi.T,old_div(1.,g_sn2)) + np.dot(w.T,(np.dot(dKuui,w)-2.*np.dot(dKui,al))) \
                                   - np.dot(al.T,(v*al)) - np.dot(np.array([(W*W).sum(axis=0)]),v) - (np.dot(R,W.T)*np.dot(B,W.T)).sum() ),2.)
                    dnlZ.cov[ii] = dnlZ.cov[ii][0,0]
                dnlZ.lik = sn2*((old_div(1.,g_sn2)).sum() - (np.array([(W*W).sum(axis=0)])).sum() - np.dot(al.T,al))
                dKuui = 2*snu2
                R = -dKuui*B
                v = -np.array([(R*B).sum(axis=0)]).T     # diag part of cov deriv
                dnlZ.lik += old_div((np.dot(w.T,np.dot(dKuui,w)) -np.dot(al.T,(v*al)) \
                                 - np.dot(np.array([(W*W).sum(axis=0)]),v) - (np.dot(R,W.T)*np.dot(B,W.T)).sum() ),2.)
                dnlZ.lik = list(dnlZ.lik[0])
                for ii in range(len(meanfunc.hyp)):
                    dnlZ.mean[ii] = np.dot(-meanfunc.getDerMatrix(x, ii).T, al)
                    dnlZ.mean[ii] = dnlZ.mean[ii][0,0]

                return post, nlZ[0,0], dnlZ
            return post, nlZ[0,0]
        return post
dataset/ETHPy150Open marionmari/pyGPs/pyGPs/Core/inf.py/FITC_Exact.evaluate/original