From 7d9352c7330d9c826c21c9e8f8cb4aee930037b5 Mon Sep 17 00:00:00 2001 From: James Hensman Date: Sun, 28 Apr 2013 21:37:36 +0100 Subject: [PATCH] weaved coregionalise. much performance gained --- GPy/kern/coregionalise.py | 62 ++++++++++++++++++++++++++++++++++--- GPy/kern/kern.py | 1 + GPy/kern/prod.py | 9 ++++-- GPy/kern/prod_orthogonal.py | 9 ++++-- 4 files changed, 70 insertions(+), 11 deletions(-) diff --git a/GPy/kern/coregionalise.py b/GPy/kern/coregionalise.py index a76bb31e..a4d22c2d 100644 --- a/GPy/kern/coregionalise.py +++ b/GPy/kern/coregionalise.py @@ -5,10 +5,11 @@ from kernpart import kernpart import numpy as np from GPy.util.linalg import mdot, pdinv import pdb +from scipy import weave class coregionalise(kernpart): """ - Kernel for Intrisec Corregionalization Models + Kernel for Intrinsic Corregionalization Models """ def __init__(self,Nout,R=1, W=None, kappa=None): self.D = 1 @@ -42,19 +43,70 @@ class coregionalise(kernpart): def K(self,index,index2,target): index = np.asarray(index,dtype=np.int) + + #here's the old code (numpy) + #if index2 is None: + #index2 = index + #else: + #index2 = np.asarray(index2,dtype=np.int) + #false_target = target.copy() + #ii,jj = np.meshgrid(index,index2) + #ii,jj = ii.T, jj.T + #false_target += self.B[ii,jj] + if index2 is None: - index2 = index + code=""" + for(int i=0;i