def Kdiag(self, X):
Kdiag = np.zeros(X.shape[<NUM_LIT:0>])<EOL>ly=<NUM_LIT:1>/self.lengthscale_Y<EOL>lu=np.sqrt(<NUM_LIT:3>)/self.lengthscale_U<EOL>Vu = self.variance_U<EOL>Vy=self.variance_Y<EOL>k1 = (<NUM_LIT:2>*lu+ly)/(lu+ly)**<NUM_LIT:2><EOL>k2 = (ly-<NUM_LIT:2>*lu + <NUM_LIT:2>*lu-ly ) / (ly-lu)**<NUM_LIT:2><EOL>k3 = <NUM_LIT:1>/(lu+ly) + (lu)/(lu+ly)**<NUM_LIT:2><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]+= self.variance_U<EOL><DEDENT>elif i==<NUM_LIT:1>:<EOL><INDENT>Kdiag[s1]+= Vu*Vy*(k1+k2+k3)<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.