def getCovMatrix(self,x=None,z=None,mode=None):
        self.checkInputGetCovMatrix(x,z,mode)
        ell = np.exp(self.hyp[0])  # characteristic length scale
        p = np.exp(2. * self.hyp[1])  # period
        if mode == 'self_test':               # self covariances for the test cases
            nn, D = z.shape
            A = np.zeros((nn, 1))
        elif mode == 'train':                 # compute covariance matix for dataset x
            A = spdist.cdist(old_div(x, ell), old_div(x, ell), 'sqeuclidean')
        elif mode == 'cross':                 # compute covariance between data sets x and z
            A = spdist.cdist(old_div(x, ell), old_div(z, ell), 'sqeuclidean')
        dp = 2 * np.pi * np.sqrt(A) * ell / p
        A = np.exp(-0.5 * A) * np.cos(dp)
        return A
dataset/ETHPy150Open marionmari/pyGPs/pyGPs/Core/cov.py/Gabor.getCovMatrix/original