diff --git a/GPy/kern/Matern52.py b/GPy/kern/Matern52.py index 377526d5..9338db15 100644 --- a/GPy/kern/Matern52.py +++ b/GPy/kern/Matern52.py @@ -90,7 +90,7 @@ class Matern52(kernpart): else: dl = (self.variance * 5./3 * dist * (1 + np.sqrt(5.)*dist ) * np.exp(-np.sqrt(5.)*dist)) * dist2M.sum(-1)*invdist #dl = (self.variance* 3 * dist * np.exp(-np.sqrt(3.)*dist)) * dist2M.sum(-1)*invdist - target[1] += np.sum(dl*dL_dKdiag) + target[1] += np.sum(dl*dL_dK) def dKdiag_dtheta(self,dL_dKdiag,X,target): """derivative of the diagonal of the covariance matrix with respect to the parameters.""" diff --git a/GPy/likelihoods/EP.py b/GPy/likelihoods/EP.py index efd887ae..30b21d9b 100644 --- a/GPy/likelihoods/EP.py +++ b/GPy/likelihoods/EP.py @@ -114,7 +114,7 @@ class EP(likelihood): Sroot_tilde_K = np.sqrt(self.tau_tilde)[:,None]*K B = np.eye(self.N) + np.sqrt(self.tau_tilde)[None,:]*Sroot_tilde_K L = jitchol(B) - V,info = linalg.flapack.dtrtrs(L,Sroot_tilde_K,lower=1) + V,info = linalg.lapack.flapack.dtrtrs(L,Sroot_tilde_K,lower=1) Sigma = K - np.dot(V.T,V) mu = np.dot(Sigma,self.v_tilde) epsilon_np1 = sum((self.tau_tilde-self.np1[-1])**2)/self.N @@ -190,7 +190,7 @@ class EP(likelihood): #Posterior distribution parameters update LLT = LLT + np.outer(Kmn[:,i],Kmn[:,i])*Delta_tau L = jitchol(LLT) - V,info = linalg.flapack.dtrtrs(L,Kmn,lower=1) + V,info = linalg.lapack.flapack.dtrtrs(L,Kmn,lower=1) Sigma_diag = np.sum(V*V,-2) si = np.sum(V.T*V[:,i],-1) mu = mu + (Delta_v-Delta_tau*mu[i])*si @@ -198,8 +198,8 @@ class EP(likelihood): #Sigma recomputation with Cholesky decompositon LLT0 = LLT0 + np.dot(Kmn*tau_tilde[None,:],Kmn.T) L = jitchol(LLT) - V,info = linalg.flapack.dtrtrs(L,Kmn,lower=1) - V2,info = linalg.flapack.dtrtrs(L.T,V,lower=0) + V,info = linalg.lapack.flapack.dtrtrs(L,Kmn,lower=1) + V2,info = linalg.lapack.flapack.dtrtrs(L.T,V,lower=0) Sigma_diag = np.sum(V*V,-2) Knmv_tilde = np.dot(Kmn,v_tilde) mu = np.dot(V2.T,Knmv_tilde) @@ -297,7 +297,7 @@ class EP(likelihood): P = (Diag / Diag0)[:,None] * P0 RPT0 = np.dot(R0,P0.T) L = jitchol(np.eye(self.M) + np.dot(RPT0,(1./Diag0 - Diag/(Diag0**2))[:,None]*RPT0.T)) - R,info = linalg.flapack.dtrtrs(L,R0,lower=1) + R,info = linalg.lapack.flapack.dtrtrs(L,R0,lower=1) RPT = np.dot(R,P.T) Sigma_diag = Diag + np.sum(RPT.T*RPT.T,-1) self.w = Diag * self.v_tilde diff --git a/GPy/util/linalg.py b/GPy/util/linalg.py index 7414eb29..26105789 100644 --- a/GPy/util/linalg.py +++ b/GPy/util/linalg.py @@ -11,7 +11,7 @@ import re import pdb import cPickle import types -import scipy.lib.lapack.flapack +#import scipy.lib.lapack.flapack import scipy as sp def mdot(*args): @@ -101,7 +101,7 @@ def chol_inv(L): """ - return linalg.flapack.dtrtri(L, lower = True)[0] + return linalg.lapack.flapack.dtrtri(L, lower = True)[0] def multiple_pdinv(A): @@ -118,7 +118,7 @@ def multiple_pdinv(A): N = A.shape[-1] chols = [jitchol(A[:,:,i]) for i in range(N)] halflogdets = [np.sum(np.log(np.diag(L[0]))) for L in chols] - invs = [linalg.flapack.dpotri(L[0],True)[0] for L in chols] + invs = [linalg.lapack.flapack.dpotri(L[0],True)[0] for L in chols] invs = [np.triu(I)+np.triu(I,1).T for I in invs] return np.dstack(invs),np.array(halflogdets)