def getDerMatrix(self,x=None,z=None,mode=None,der=None):
        self.checkInputGetDerMatrix(x,z,mode,der)
        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

        if der == 0:                          # compute derivative matrix wrt 1st parameter
            A = np.exp(-0.5 * A) * np.cos(dp)
            A = dp * A
        elif der == 1:                        # compute derivative matrix wrt 2nd parameter
            A = np.exp(-0.5 * A) * np.cos(dp)
            A = np.tan(dp) * dp * A
        else:
            raise Exception("Wrong derivative entry in Gabor")

        return A
dataset/ETHPy150Open marionmari/pyGPs/pyGPs/Core/cov.py/Gabor.getDerMatrix/original