def Kdiag(self, X):
vyt = self.variance_Yt<EOL>vyx = self.variance_Yx<EOL>lyt = <NUM_LIT:1.>/(<NUM_LIT:2>*self.lengthscale_Yt)<EOL>lyx = <NUM_LIT:1.>/(<NUM_LIT:2>*self.lengthscale_Yx)<EOL>a = self.a<EOL>b = self.b<EOL>c = self.c<EOL>k1 = (<NUM_LIT:2>*lyt )*vyt*vyx<EOL>k2 = ( - <NUM_LIT:2>*lyx )*vyt*vyx<EOL>k3 = ( <NUM_LIT:4>*<NUM_LIT:3>*lyx**<NUM_LIT:2> )*vyt*vyx<EOL>Kdiag = np.zeros(X.shape[<NUM_LIT:0>])<EOL>slices = index_to_slices(X[:,-<NUM_LIT:1>])<EOL>for i, ss1 in enumerate(slices):<EOL><INDENT>for s1 in ss1:<EOL><INDENT>if i==<NUM_LIT:0>:<EOL><INDENT>Kdiag[s1]+= vyt*vyx<EOL><DEDENT>elif i==<NUM_LIT:1>:<EOL><INDENT>Kdiag[s1]+= b**<NUM_LIT:2>*k1 - <NUM_LIT:2>*a*c*k2 + a**<NUM_LIT:2>*k3 + c**<NUM_LIT:2>*vyt*vyx<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>return Kdiag<EOL>
Compute the diagonal of the covariance matrix associated to X.