fixed coregionalize cython

This commit is contained in:
James Hensman 2015-04-28 15:57:27 +01:00
parent 9e4c33910f
commit 1ebbc49fdd
5 changed files with 437 additions and 232 deletions

View file

@ -73,8 +73,8 @@ class Coregionalize(Kern):
def _K_cython(self, X, X2=None):
if X2 is None:
return coregionalize_cython.K_symmetric(self.B, X[:,0])
return coregionalize_cython.K_asymmetric(self.B, X[:,0], X2[:,0])
return coregionalize_cython.K_symmetric(self.B, np.asarray(X, dtype=np.int64)[:,0])
return coregionalize_cython.K_asymmetric(self.B, np.asarray(X, dtype=np.int64)[:,0], np.asarray(X2, dtype=np.int64)[:,0])
def Kdiag(self, X):

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
#cython: boundscheck=False
#cython: wraparound=False
#cython: boundscheck=True
#cython: wraparound=True
import cython
import numpy as np
cimport numpy as np
@ -25,9 +25,9 @@ def gradient_reduce(int D, np.ndarray[double, ndim=2] dL_dK, np.ndarray[np.int64
cdef np.ndarray[np.double_t, ndim=2] dL_dK_small = np.zeros((D, D))
cdef int N = index.size
cdef int M = index2.size
for i in range(M):
for j in range(N):
dL_dK_small[index[j],index2[i]] += dL_dK[i,j];
for i in range(N):
for j in range(M):
dL_dK_small[index2[j],index[i]] += dL_dK[i,j];
return dL_dK_small