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
        sf2 = np.exp(2.* self.hyp[1])    # signal variance
        d   = self.para[0]               # 2 times nu
        if np.abs(d-np.round(d)) < 1e-8: # remove numerical error from format of parameter
            d = int(round(d))
        d = int(d)
        try:
            assert(d in [1,3,5,7])         # check for valid values of d
        except AssertionError:
            print("Warning: You specified d to be neither 1,3,5 nor 7. We set to d=3. ")
            d = 3
        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
            x = np.sqrt(d)*x/ell
            A = np.sqrt(spdist.cdist(x, x, 'sqeuclidean'))
        elif mode == 'cross':             # compute covariance between data sets x and z
            x = np.sqrt(d)*x/ell
            z = np.sqrt(d)*z/ell
            A = np.sqrt(spdist.cdist(x, z, 'sqeuclidean'))
        A = sf2 * self.mfunc(d,A)
        if der == 0:                    # compute derivative matrix wrt 1st parameter
            A = sf2 * self.dmfunc(d,A)
        elif der == 1:                  # compute derivative matrix wrt 2nd parameter
            A = 2 * sf2 * self.mfunc(d,A)
        elif der == 2:                  # no derivative wrt 3rd parameter
            A = np.zeros_like(A)        # do nothing (d is not learned)
        else:
            raise Exception("Wrong derivative value in Matern")
        return A
dataset/ETHPy150Open marionmari/pyGPs/pyGPs/Core/cov.py/Matern.getDerMatrix/original