mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-15 06:52:39 +02:00
Merge pull request #708 from KOLANICH/cython_code_fix
Integer division is needed here.
This commit is contained in:
commit
0b8fd0d951
1 changed files with 2 additions and 2 deletions
|
|
@ -14,7 +14,7 @@ np.import_array()
|
||||||
def flat_to_triang(double[:, :] flat, int M):
|
def flat_to_triang(double[:, :] flat, int M):
|
||||||
"""take a matrix N x D and return a D X M x M array where
|
"""take a matrix N x D and return a D X M x M array where
|
||||||
|
|
||||||
N = M(M+1)/2
|
N = M(M+1)//2
|
||||||
|
|
||||||
the lower triangluar portion of the d'th slice of the result is filled by the d'th column of flat.
|
the lower triangluar portion of the d'th slice of the result is filled by the d'th column of flat.
|
||||||
"""
|
"""
|
||||||
|
|
@ -35,7 +35,7 @@ def flat_to_triang(double[:, :] flat, int M):
|
||||||
def triang_to_flat(double[:, :, :] L):
|
def triang_to_flat(double[:, :, :] L):
|
||||||
cdef int D = L.shape[0]
|
cdef int D = L.shape[0]
|
||||||
cdef int M = L.shape[1]
|
cdef int M = L.shape[1]
|
||||||
cdef int N = M*(M+1)/2
|
cdef int N = M*(M+1)//2
|
||||||
cdef int count = 0
|
cdef int count = 0
|
||||||
cdef double[:, ::1] flat = np.empty((N, D))
|
cdef double[:, ::1] flat = np.empty((N, D))
|
||||||
cdef int d, m, mm
|
cdef int d, m, mm
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue