def K(self, X, X2=None):
if X2 is None:<EOL><INDENT>X2 = X<EOL><DEDENT>base = np.pi * (X[:, None, :] - X2[None, :, :]) / self.period<EOL>exp_dist = np.exp( -<NUM_LIT:0.5>* np.sum( np.square(  np.sin( base ) / self.lengthscale ), axis = -<NUM_LIT:1> ) )<EOL>return self.variance * exp_dist<EOL>
Compute the covariance matrix between X and X2.