def getDerMatrix(self,x=None,z=None,mode=None,der=None):
        self.checkInputGetDerMatrix(x,z,mode,der)
        if not x is None:
            n, D = x.shape
        if not z is None:
            nn, D = z.shape
        ell = old_div(1., np.exp(self.hyp[0:D]))  # characteristic length scale
        sf2 = np.exp(2.*self.hyp[D])        # signal variance
        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
            tem = np.dot(np.diag(ell),x.T).T
            A = spdist.cdist(tem,tem,'sqeuclidean')
        elif mode == 'cross':             # compute covariance between data sets x and z
            A = spdist.cdist(np.dot(np.diag(ell),x.T).T,np.dot(np.diag(ell),z.T).T,'sqeuclidean')
        A = sf2*np.exp(-0.5*A)
        if D < der:                       # compute derivative matrix wrt length scale parameters
            if mode == 'self_test':
                A = A*0
            elif mode == 'train':
                # tem = (np.atleast_2d(x[:,der])/ell[der])  # buggy. Need the transpose for spdist.cdist to work properly
                # tem = (np.atleast_2d(x[:,der])/ell[der]).T  # buggy version
                tem = (np.atleast_2d(x[:,der])*ell[der]).T
                A *= spdist.cdist(tem,tem,'sqeuclidean')
            elif mode == 'cross':
                # A *= spdist.cdist(np.atleast_2d(x[:,der]).T/ell[der],np.atleast_2d(z[:,der]).T/ell[der],'sqeuclidean')  # buggy version
                A *= spdist.cdist(np.atleast_2d(x[:, der]).T * ell[der], np.atleast_2d(z[:, der]).T * ell[der], 'sqeuclidean')
        elif der == D:                    # compute derivative matrix wrt magnitude parameter
            A = 2.*A
        else:
            raise Exception("Wrong derivative index in RDFard")
        return A
dataset/ETHPy150Open marionmari/pyGPs/pyGPs/Core/cov.py/RBFard.getDerMatrix/swapped operands of `<`