mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-08 11:32:39 +02:00
some eidts to choleskies.pyx
This commit is contained in:
parent
5edf464efa
commit
59cf0b3c9a
9 changed files with 6944 additions and 131 deletions
|
|
@ -6,7 +6,6 @@ from numpy.lib.function_base import vectorize
|
||||||
from .lists_and_dicts import IntArrayDict
|
from .lists_and_dicts import IntArrayDict
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from transformations import Transformation
|
from transformations import Transformation
|
||||||
from priors import Prior
|
|
||||||
|
|
||||||
def extract_properties_to_index(index, props):
|
def extract_properties_to_index(index, props):
|
||||||
prop_index = dict()
|
prop_index = dict()
|
||||||
|
|
@ -146,7 +145,6 @@ class ParameterIndexOperations(object):
|
||||||
return prop_index
|
return prop_index
|
||||||
|
|
||||||
def add(self, prop, indices):
|
def add(self, prop, indices):
|
||||||
#assert isinstance(prop, (Transformation, Prior)), "invalid key"
|
|
||||||
self._properties[prop] = combine_indices(self._properties[prop], indices)
|
self._properties[prop] = combine_indices(self._properties[prop], indices)
|
||||||
|
|
||||||
def remove(self, prop, indices):
|
def remove(self, prop, indices):
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ import numpy; np = numpy
|
||||||
import itertools
|
import itertools
|
||||||
from re import compile, _pattern_type
|
from re import compile, _pattern_type
|
||||||
from .param import ParamConcatenation
|
from .param import ParamConcatenation
|
||||||
from .parameter_core import HierarchyError, Parameterizable, adjust_name_for_printing
|
from parameter_core import HierarchyError, Parameterizable, adjust_name_for_printing
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from GPy.core.parameterization.index_operations import ParameterIndexOperationsView
|
from index_operations import ParameterIndexOperationsView
|
||||||
logger = logging.getLogger("parameters changed meta")
|
logger = logging.getLogger("parameters changed meta")
|
||||||
|
|
||||||
class ParametersChangedMeta(type):
|
class ParametersChangedMeta(type):
|
||||||
|
|
|
||||||
|
|
@ -730,7 +730,7 @@ class DGPLVM(Prior):
|
||||||
|
|
||||||
# ******************************************
|
# ******************************************
|
||||||
|
|
||||||
from parameterized import Parameterized
|
from .. import Parameterized
|
||||||
from .. import Param
|
from .. import Param
|
||||||
class DGPLVM_Lamda(Prior, Parameterized):
|
class DGPLVM_Lamda(Prior, Parameterized):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,6 @@ MKL = False
|
||||||
[weave]
|
[weave]
|
||||||
#if true, try to use weave, and fall back to numpy. if false, just use numpy.
|
#if true, try to use weave, and fall back to numpy. if false, just use numpy.
|
||||||
working = True
|
working = True
|
||||||
|
|
||||||
|
[cython]
|
||||||
|
working = True
|
||||||
|
|
|
||||||
6582
GPy/kern/_src/coregionalize_cython.c
Normal file
6582
GPy/kern/_src/coregionalize_cython.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -831,15 +831,14 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec
|
||||||
|
|
||||||
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
|
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
|
||||||
|
|
||||||
|
static void __Pyx_RaiseBufferIndexError(int axis);
|
||||||
|
|
||||||
|
#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
|
||||||
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
|
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
|
||||||
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
|
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
|
||||||
|
|
||||||
static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
|
static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
|
||||||
|
|
||||||
static void __Pyx_RaiseBufferIndexError(int axis);
|
|
||||||
|
|
||||||
#define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
|
|
||||||
#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
|
|
||||||
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
|
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
|
||||||
|
|
||||||
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
|
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
|
||||||
|
|
@ -1089,6 +1088,7 @@ static char __pyx_k_count[] = "count";
|
||||||
static char __pyx_k_empty[] = "empty";
|
static char __pyx_k_empty[] = "empty";
|
||||||
static char __pyx_k_numpy[] = "numpy";
|
static char __pyx_k_numpy[] = "numpy";
|
||||||
static char __pyx_k_range[] = "range";
|
static char __pyx_k_range[] = "range";
|
||||||
|
static char __pyx_k_zeros[] = "zeros";
|
||||||
static char __pyx_k_import[] = "__import__";
|
static char __pyx_k_import[] = "__import__";
|
||||||
static char __pyx_k_linalg[] = "linalg";
|
static char __pyx_k_linalg[] = "linalg";
|
||||||
static char __pyx_k_ValueError[] = "ValueError";
|
static char __pyx_k_ValueError[] = "ValueError";
|
||||||
|
|
@ -1097,7 +1097,7 @@ static char __pyx_k_flat_to_triang[] = "flat_to_triang";
|
||||||
static char __pyx_k_triang_to_flat[] = "triang_to_flat";
|
static char __pyx_k_triang_to_flat[] = "triang_to_flat";
|
||||||
static char __pyx_k_GPy_util_choleskies_cython[] = "GPy.util.choleskies_cython";
|
static char __pyx_k_GPy_util_choleskies_cython[] = "GPy.util.choleskies_cython";
|
||||||
static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
|
static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
|
||||||
static char __pyx_k_home_james_work_GPy_GPy_util_ch[] = "/home/james/work/GPy/GPy/util/choleskies_cython.pyx";
|
static char __pyx_k_Users_james_work_GPy_GPy_util_c[] = "/Users/james/work/GPy/GPy/util/choleskies_cython.pyx";
|
||||||
static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
|
static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
|
||||||
static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
|
static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
|
||||||
static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
|
static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
|
||||||
|
|
@ -1112,6 +1112,7 @@ static PyObject *__pyx_n_s_M;
|
||||||
static PyObject *__pyx_n_s_N;
|
static PyObject *__pyx_n_s_N;
|
||||||
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
|
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
|
||||||
static PyObject *__pyx_n_s_RuntimeError;
|
static PyObject *__pyx_n_s_RuntimeError;
|
||||||
|
static PyObject *__pyx_kp_s_Users_james_work_GPy_GPy_util_c;
|
||||||
static PyObject *__pyx_n_s_ValueError;
|
static PyObject *__pyx_n_s_ValueError;
|
||||||
static PyObject *__pyx_n_s__7;
|
static PyObject *__pyx_n_s__7;
|
||||||
static PyObject *__pyx_n_s_count;
|
static PyObject *__pyx_n_s_count;
|
||||||
|
|
@ -1119,7 +1120,6 @@ static PyObject *__pyx_n_s_d;
|
||||||
static PyObject *__pyx_n_s_empty;
|
static PyObject *__pyx_n_s_empty;
|
||||||
static PyObject *__pyx_n_s_flat;
|
static PyObject *__pyx_n_s_flat;
|
||||||
static PyObject *__pyx_n_s_flat_to_triang;
|
static PyObject *__pyx_n_s_flat_to_triang;
|
||||||
static PyObject *__pyx_kp_s_home_james_work_GPy_GPy_util_ch;
|
|
||||||
static PyObject *__pyx_n_s_import;
|
static PyObject *__pyx_n_s_import;
|
||||||
static PyObject *__pyx_n_s_linalg;
|
static PyObject *__pyx_n_s_linalg;
|
||||||
static PyObject *__pyx_n_s_m;
|
static PyObject *__pyx_n_s_m;
|
||||||
|
|
@ -1134,6 +1134,8 @@ static PyObject *__pyx_n_s_ret;
|
||||||
static PyObject *__pyx_n_s_test;
|
static PyObject *__pyx_n_s_test;
|
||||||
static PyObject *__pyx_n_s_triang_to_flat;
|
static PyObject *__pyx_n_s_triang_to_flat;
|
||||||
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
|
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
|
||||||
|
static PyObject *__pyx_n_s_zeros;
|
||||||
|
static PyObject *__pyx_int_1;
|
||||||
static PyObject *__pyx_tuple_;
|
static PyObject *__pyx_tuple_;
|
||||||
static PyObject *__pyx_tuple__2;
|
static PyObject *__pyx_tuple__2;
|
||||||
static PyObject *__pyx_tuple__3;
|
static PyObject *__pyx_tuple__3;
|
||||||
|
|
@ -1148,7 +1150,7 @@ static PyObject *__pyx_codeobj__11;
|
||||||
/* "GPy/util/choleskies_cython.pyx":8
|
/* "GPy/util/choleskies_cython.pyx":8
|
||||||
* from . import linalg
|
* from . import linalg
|
||||||
*
|
*
|
||||||
* def flat_to_triang(np.ndarray[double, ndim=3] flat, int M): # <<<<<<<<<<<<<<
|
* def flat_to_triang(np.ndarray[double, ndim=2] flat, int M): # <<<<<<<<<<<<<<
|
||||||
* """take a matrix N x D and return a M X M x D array where
|
* """take a matrix N x D and return a M X M x D array where
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -1227,8 +1229,8 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
int __pyx_v_count;
|
int __pyx_v_count;
|
||||||
PyArrayObject *__pyx_v_ret = 0;
|
PyArrayObject *__pyx_v_ret = 0;
|
||||||
int __pyx_v_d;
|
int __pyx_v_d;
|
||||||
int __pyx_v_m;
|
PyObject *__pyx_v_m = NULL;
|
||||||
int __pyx_v_mm;
|
PyObject *__pyx_v_mm = NULL;
|
||||||
__Pyx_LocalBuf_ND __pyx_pybuffernd_flat;
|
__Pyx_LocalBuf_ND __pyx_pybuffernd_flat;
|
||||||
__Pyx_Buffer __pyx_pybuffer_flat;
|
__Pyx_Buffer __pyx_pybuffer_flat;
|
||||||
__Pyx_LocalBuf_ND __pyx_pybuffernd_ret;
|
__Pyx_LocalBuf_ND __pyx_pybuffernd_ret;
|
||||||
|
|
@ -1244,10 +1246,13 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
PyArrayObject *__pyx_t_7 = NULL;
|
PyArrayObject *__pyx_t_7 = NULL;
|
||||||
int __pyx_t_8;
|
int __pyx_t_8;
|
||||||
int __pyx_t_9;
|
int __pyx_t_9;
|
||||||
int __pyx_t_10;
|
Py_ssize_t __pyx_t_10;
|
||||||
int __pyx_t_11;
|
PyObject *(*__pyx_t_11)(PyObject *);
|
||||||
int __pyx_t_12;
|
Py_ssize_t __pyx_t_12;
|
||||||
int __pyx_t_13;
|
PyObject *(*__pyx_t_13)(PyObject *);
|
||||||
|
int __pyx_t_14;
|
||||||
|
int __pyx_t_15;
|
||||||
|
int __pyx_t_16;
|
||||||
int __pyx_lineno = 0;
|
int __pyx_lineno = 0;
|
||||||
const char *__pyx_filename = NULL;
|
const char *__pyx_filename = NULL;
|
||||||
int __pyx_clineno = 0;
|
int __pyx_clineno = 0;
|
||||||
|
|
@ -1262,9 +1267,9 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
__pyx_pybuffernd_flat.rcbuffer = &__pyx_pybuffer_flat;
|
__pyx_pybuffernd_flat.rcbuffer = &__pyx_pybuffer_flat;
|
||||||
{
|
{
|
||||||
__Pyx_BufFmt_StackElem __pyx_stack[1];
|
__Pyx_BufFmt_StackElem __pyx_stack[1];
|
||||||
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flat.rcbuffer->pybuffer, (PyObject*)__pyx_v_flat, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flat.rcbuffer->pybuffer, (PyObject*)__pyx_v_flat, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
}
|
}
|
||||||
__pyx_pybuffernd_flat.diminfo[0].strides = __pyx_pybuffernd_flat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flat.diminfo[0].shape = __pyx_pybuffernd_flat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_flat.diminfo[1].strides = __pyx_pybuffernd_flat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_flat.diminfo[1].shape = __pyx_pybuffernd_flat.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_flat.diminfo[2].strides = __pyx_pybuffernd_flat.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_flat.diminfo[2].shape = __pyx_pybuffernd_flat.rcbuffer->pybuffer.shape[2];
|
__pyx_pybuffernd_flat.diminfo[0].strides = __pyx_pybuffernd_flat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flat.diminfo[0].shape = __pyx_pybuffernd_flat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_flat.diminfo[1].strides = __pyx_pybuffernd_flat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_flat.diminfo[1].shape = __pyx_pybuffernd_flat.rcbuffer->pybuffer.shape[1];
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":16
|
/* "GPy/util/choleskies_cython.pyx":16
|
||||||
* This is the weave implementation
|
* This is the weave implementation
|
||||||
|
|
@ -1280,7 +1285,7 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
* cdef int N = flat.shape[0]
|
* cdef int N = flat.shape[0]
|
||||||
* cdef int D = flat.shape[1] # <<<<<<<<<<<<<<
|
* cdef int D = flat.shape[1] # <<<<<<<<<<<<<<
|
||||||
* cdef int count = 0
|
* cdef int count = 0
|
||||||
* cdef np.ndarray[double, ndim=2] ret = np.empty((M, M, D))
|
* cdef np.ndarray[double, ndim=3] ret = np.zeros((M, M, D))
|
||||||
*/
|
*/
|
||||||
__pyx_v_D = (__pyx_v_flat->dimensions[1]);
|
__pyx_v_D = (__pyx_v_flat->dimensions[1]);
|
||||||
|
|
||||||
|
|
@ -1288,7 +1293,7 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
* cdef int N = flat.shape[0]
|
* cdef int N = flat.shape[0]
|
||||||
* cdef int D = flat.shape[1]
|
* cdef int D = flat.shape[1]
|
||||||
* cdef int count = 0 # <<<<<<<<<<<<<<
|
* cdef int count = 0 # <<<<<<<<<<<<<<
|
||||||
* cdef np.ndarray[double, ndim=2] ret = np.empty((M, M, D))
|
* cdef np.ndarray[double, ndim=3] ret = np.zeros((M, M, D))
|
||||||
* for d in range(D):
|
* for d in range(D):
|
||||||
*/
|
*/
|
||||||
__pyx_v_count = 0;
|
__pyx_v_count = 0;
|
||||||
|
|
@ -1296,13 +1301,13 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
/* "GPy/util/choleskies_cython.pyx":19
|
/* "GPy/util/choleskies_cython.pyx":19
|
||||||
* cdef int D = flat.shape[1]
|
* cdef int D = flat.shape[1]
|
||||||
* cdef int count = 0
|
* cdef int count = 0
|
||||||
* cdef np.ndarray[double, ndim=2] ret = np.empty((M, M, D)) # <<<<<<<<<<<<<<
|
* cdef np.ndarray[double, ndim=3] ret = np.zeros((M, M, D)) # <<<<<<<<<<<<<<
|
||||||
* for d in range(D):
|
* for d in range(D):
|
||||||
* count = 0
|
* count = 0
|
||||||
*/
|
*/
|
||||||
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_GOTREF(__pyx_t_2);
|
__Pyx_GOTREF(__pyx_t_2);
|
||||||
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_GOTREF(__pyx_t_3);
|
__Pyx_GOTREF(__pyx_t_3);
|
||||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||||
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_M); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_M); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
|
@ -1352,10 +1357,10 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
__pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
|
__pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
|
||||||
{
|
{
|
||||||
__Pyx_BufFmt_StackElem __pyx_stack[1];
|
__Pyx_BufFmt_StackElem __pyx_stack[1];
|
||||||
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ret.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
|
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ret.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
|
||||||
__pyx_v_ret = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ret.rcbuffer->pybuffer.buf = NULL;
|
__pyx_v_ret = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ret.rcbuffer->pybuffer.buf = NULL;
|
||||||
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
} else {__pyx_pybuffernd_ret.diminfo[0].strides = __pyx_pybuffernd_ret.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ret.diminfo[0].shape = __pyx_pybuffernd_ret.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ret.diminfo[1].strides = __pyx_pybuffernd_ret.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ret.diminfo[1].shape = __pyx_pybuffernd_ret.rcbuffer->pybuffer.shape[1];
|
} else {__pyx_pybuffernd_ret.diminfo[0].strides = __pyx_pybuffernd_ret.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ret.diminfo[0].shape = __pyx_pybuffernd_ret.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ret.diminfo[1].strides = __pyx_pybuffernd_ret.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ret.diminfo[1].shape = __pyx_pybuffernd_ret.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ret.diminfo[2].strides = __pyx_pybuffernd_ret.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ret.diminfo[2].shape = __pyx_pybuffernd_ret.rcbuffer->pybuffer.shape[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__pyx_t_7 = 0;
|
__pyx_t_7 = 0;
|
||||||
|
|
@ -1364,7 +1369,7 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":20
|
/* "GPy/util/choleskies_cython.pyx":20
|
||||||
* cdef int count = 0
|
* cdef int count = 0
|
||||||
* cdef np.ndarray[double, ndim=2] ret = np.empty((M, M, D))
|
* cdef np.ndarray[double, ndim=3] ret = np.zeros((M, M, D))
|
||||||
* for d in range(D): # <<<<<<<<<<<<<<
|
* for d in range(D): # <<<<<<<<<<<<<<
|
||||||
* count = 0
|
* count = 0
|
||||||
* for m in range(M):
|
* for m in range(M):
|
||||||
|
|
@ -1374,11 +1379,11 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
__pyx_v_d = __pyx_t_9;
|
__pyx_v_d = __pyx_t_9;
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":21
|
/* "GPy/util/choleskies_cython.pyx":21
|
||||||
* cdef np.ndarray[double, ndim=2] ret = np.empty((M, M, D))
|
* cdef np.ndarray[double, ndim=3] ret = np.zeros((M, M, D))
|
||||||
* for d in range(D):
|
* for d in range(D):
|
||||||
* count = 0 # <<<<<<<<<<<<<<
|
* count = 0 # <<<<<<<<<<<<<<
|
||||||
* for m in range(M):
|
* for m in range(M):
|
||||||
* for mm in range(m):
|
* for mm in range(m+1):
|
||||||
*/
|
*/
|
||||||
__pyx_v_count = 0;
|
__pyx_v_count = 0;
|
||||||
|
|
||||||
|
|
@ -1386,77 +1391,187 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
* for d in range(D):
|
* for d in range(D):
|
||||||
* count = 0
|
* count = 0
|
||||||
* for m in range(M): # <<<<<<<<<<<<<<
|
* for m in range(M): # <<<<<<<<<<<<<<
|
||||||
* for mm in range(m):
|
* for mm in range(m+1):
|
||||||
* ret[m, mm, d] = flat[count,d]
|
* ret[m, mm, d] = flat[count,d]
|
||||||
*/
|
*/
|
||||||
__pyx_t_10 = __pyx_v_M;
|
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_M); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__pyx_v_m = __pyx_t_11;
|
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_3);
|
||||||
|
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
|
||||||
|
__Pyx_GIVEREF(__pyx_t_1);
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
||||||
|
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
|
||||||
|
__pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0;
|
||||||
|
__pyx_t_11 = NULL;
|
||||||
|
} else {
|
||||||
|
__pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_3);
|
||||||
|
__pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
}
|
||||||
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
for (;;) {
|
||||||
|
if (likely(!__pyx_t_11)) {
|
||||||
|
if (likely(PyList_CheckExact(__pyx_t_3))) {
|
||||||
|
if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break;
|
||||||
|
#if CYTHON_COMPILING_IN_CPYTHON
|
||||||
|
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#else
|
||||||
|
__pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
|
||||||
|
#if CYTHON_COMPILING_IN_CPYTHON
|
||||||
|
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#else
|
||||||
|
__pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
__pyx_t_1 = __pyx_t_11(__pyx_t_3);
|
||||||
|
if (unlikely(!__pyx_t_1)) {
|
||||||
|
PyObject* exc_type = PyErr_Occurred();
|
||||||
|
if (exc_type) {
|
||||||
|
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
|
||||||
|
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
}
|
||||||
|
__Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_1);
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":23
|
/* "GPy/util/choleskies_cython.pyx":23
|
||||||
* count = 0
|
* count = 0
|
||||||
* for m in range(M):
|
* for m in range(M):
|
||||||
* for mm in range(m): # <<<<<<<<<<<<<<
|
* for mm in range(m+1): # <<<<<<<<<<<<<<
|
||||||
* ret[m, mm, d] = flat[count,d]
|
* ret[m, mm, d] = flat[count,d]
|
||||||
* count += 1
|
* count += 1
|
||||||
*/
|
*/
|
||||||
__pyx_t_12 = __pyx_v_m;
|
__pyx_t_1 = PyNumber_Add(__pyx_v_m, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__pyx_v_mm = __pyx_t_13;
|
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_4);
|
||||||
|
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
|
||||||
|
__Pyx_GIVEREF(__pyx_t_1);
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||||
|
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
|
||||||
|
__pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0;
|
||||||
|
__pyx_t_13 = NULL;
|
||||||
|
} else {
|
||||||
|
__pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_4);
|
||||||
|
__pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
}
|
||||||
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
for (;;) {
|
||||||
|
if (likely(!__pyx_t_13)) {
|
||||||
|
if (likely(PyList_CheckExact(__pyx_t_4))) {
|
||||||
|
if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4)) break;
|
||||||
|
#if CYTHON_COMPILING_IN_CPYTHON
|
||||||
|
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#else
|
||||||
|
__pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
|
||||||
|
#if CYTHON_COMPILING_IN_CPYTHON
|
||||||
|
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#else
|
||||||
|
__pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
__pyx_t_1 = __pyx_t_13(__pyx_t_4);
|
||||||
|
if (unlikely(!__pyx_t_1)) {
|
||||||
|
PyObject* exc_type = PyErr_Occurred();
|
||||||
|
if (exc_type) {
|
||||||
|
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
|
||||||
|
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
}
|
||||||
|
__Pyx_XDECREF_SET(__pyx_v_mm, __pyx_t_1);
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":24
|
/* "GPy/util/choleskies_cython.pyx":24
|
||||||
* for m in range(M):
|
* for m in range(M):
|
||||||
* for mm in range(m):
|
* for mm in range(m+1):
|
||||||
* ret[m, mm, d] = flat[count,d] # <<<<<<<<<<<<<<
|
* ret[m, mm, d] = flat[count,d] # <<<<<<<<<<<<<<
|
||||||
* count += 1
|
* count += 1
|
||||||
* return ret
|
* return ret
|
||||||
*/
|
*/
|
||||||
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_14 = __pyx_v_count;
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__pyx_t_15 = __pyx_v_d;
|
||||||
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_16 = -1;
|
||||||
__Pyx_GOTREF(__pyx_t_3);
|
if (__pyx_t_14 < 0) {
|
||||||
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_14 += __pyx_pybuffernd_flat.diminfo[0].shape;
|
||||||
__Pyx_GOTREF(__pyx_t_4);
|
if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0;
|
||||||
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
|
} else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_flat.diminfo[0].shape)) __pyx_t_16 = 0;
|
||||||
__Pyx_GIVEREF(__pyx_t_1);
|
if (__pyx_t_15 < 0) {
|
||||||
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
|
__pyx_t_15 += __pyx_pybuffernd_flat.diminfo[1].shape;
|
||||||
__Pyx_GIVEREF(__pyx_t_3);
|
if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
|
||||||
__pyx_t_1 = 0;
|
} else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_flat.diminfo[1].shape)) __pyx_t_16 = 1;
|
||||||
__pyx_t_3 = 0;
|
if (unlikely(__pyx_t_16 != -1)) {
|
||||||
__pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_flat), __pyx_t_4); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
|
__Pyx_RaiseBufferIndexError(__pyx_t_16);
|
||||||
__Pyx_GOTREF(__pyx_t_3);
|
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
}
|
||||||
__pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_flat.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_flat.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_flat.diminfo[1].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_GOTREF(__pyx_t_4);
|
|
||||||
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_mm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_d); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_d); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_GOTREF(__pyx_t_6);
|
__Pyx_GOTREF(__pyx_t_6);
|
||||||
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_GOTREF(__pyx_t_5);
|
__Pyx_GOTREF(__pyx_t_5);
|
||||||
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
|
__Pyx_INCREF(__pyx_v_m);
|
||||||
__Pyx_GIVEREF(__pyx_t_4);
|
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_m);
|
||||||
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
|
__Pyx_GIVEREF(__pyx_v_m);
|
||||||
__Pyx_GIVEREF(__pyx_t_1);
|
__Pyx_INCREF(__pyx_v_mm);
|
||||||
|
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_mm);
|
||||||
|
__Pyx_GIVEREF(__pyx_v_mm);
|
||||||
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6);
|
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6);
|
||||||
__Pyx_GIVEREF(__pyx_t_6);
|
__Pyx_GIVEREF(__pyx_t_6);
|
||||||
__pyx_t_4 = 0;
|
|
||||||
__pyx_t_1 = 0;
|
|
||||||
__pyx_t_6 = 0;
|
__pyx_t_6 = 0;
|
||||||
if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_ret), __pyx_t_5, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_ret), __pyx_t_5, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
||||||
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":25
|
/* "GPy/util/choleskies_cython.pyx":25
|
||||||
* for mm in range(m):
|
* for mm in range(m+1):
|
||||||
* ret[m, mm, d] = flat[count,d]
|
* ret[m, mm, d] = flat[count,d]
|
||||||
* count += 1 # <<<<<<<<<<<<<<
|
* count += 1 # <<<<<<<<<<<<<<
|
||||||
* return ret
|
* return ret
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
__pyx_v_count = (__pyx_v_count + 1);
|
__pyx_v_count = (__pyx_v_count + 1);
|
||||||
|
|
||||||
|
/* "GPy/util/choleskies_cython.pyx":23
|
||||||
|
* count = 0
|
||||||
|
* for m in range(M):
|
||||||
|
* for mm in range(m+1): # <<<<<<<<<<<<<<
|
||||||
|
* ret[m, mm, d] = flat[count,d]
|
||||||
|
* count += 1
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||||
|
|
||||||
|
/* "GPy/util/choleskies_cython.pyx":22
|
||||||
|
* for d in range(D):
|
||||||
|
* count = 0
|
||||||
|
* for m in range(M): # <<<<<<<<<<<<<<
|
||||||
|
* for mm in range(m+1):
|
||||||
|
* ret[m, mm, d] = flat[count,d]
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":26
|
/* "GPy/util/choleskies_cython.pyx":26
|
||||||
|
|
@ -1474,7 +1589,7 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
/* "GPy/util/choleskies_cython.pyx":8
|
/* "GPy/util/choleskies_cython.pyx":8
|
||||||
* from . import linalg
|
* from . import linalg
|
||||||
*
|
*
|
||||||
* def flat_to_triang(np.ndarray[double, ndim=3] flat, int M): # <<<<<<<<<<<<<<
|
* def flat_to_triang(np.ndarray[double, ndim=2] flat, int M): # <<<<<<<<<<<<<<
|
||||||
* """take a matrix N x D and return a M X M x D array where
|
* """take a matrix N x D and return a M X M x D array where
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -1500,6 +1615,8 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_flat_to_triang(CYTHON_U
|
||||||
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ret.rcbuffer->pybuffer);
|
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ret.rcbuffer->pybuffer);
|
||||||
__pyx_L2:;
|
__pyx_L2:;
|
||||||
__Pyx_XDECREF((PyObject *)__pyx_v_ret);
|
__Pyx_XDECREF((PyObject *)__pyx_v_ret);
|
||||||
|
__Pyx_XDECREF(__pyx_v_m);
|
||||||
|
__Pyx_XDECREF(__pyx_v_mm);
|
||||||
__Pyx_XGIVEREF(__pyx_r);
|
__Pyx_XGIVEREF(__pyx_r);
|
||||||
__Pyx_RefNannyFinishContext();
|
__Pyx_RefNannyFinishContext();
|
||||||
return __pyx_r;
|
return __pyx_r;
|
||||||
|
|
@ -1542,8 +1659,8 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_2triang_to_flat(CYTHON_
|
||||||
int __pyx_v_count;
|
int __pyx_v_count;
|
||||||
PyArrayObject *__pyx_v_flat = 0;
|
PyArrayObject *__pyx_v_flat = 0;
|
||||||
int __pyx_v_d;
|
int __pyx_v_d;
|
||||||
int __pyx_v_m;
|
PyObject *__pyx_v_m = NULL;
|
||||||
int __pyx_v_mm;
|
PyObject *__pyx_v_mm = NULL;
|
||||||
__Pyx_LocalBuf_ND __pyx_pybuffernd_L;
|
__Pyx_LocalBuf_ND __pyx_pybuffernd_L;
|
||||||
__Pyx_Buffer __pyx_pybuffer_L;
|
__Pyx_Buffer __pyx_pybuffer_L;
|
||||||
__Pyx_LocalBuf_ND __pyx_pybuffernd_flat;
|
__Pyx_LocalBuf_ND __pyx_pybuffernd_flat;
|
||||||
|
|
@ -1558,16 +1675,14 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_2triang_to_flat(CYTHON_
|
||||||
PyArrayObject *__pyx_t_6 = NULL;
|
PyArrayObject *__pyx_t_6 = NULL;
|
||||||
int __pyx_t_7;
|
int __pyx_t_7;
|
||||||
int __pyx_t_8;
|
int __pyx_t_8;
|
||||||
int __pyx_t_9;
|
Py_ssize_t __pyx_t_9;
|
||||||
int __pyx_t_10;
|
PyObject *(*__pyx_t_10)(PyObject *);
|
||||||
int __pyx_t_11;
|
Py_ssize_t __pyx_t_11;
|
||||||
int __pyx_t_12;
|
PyObject *(*__pyx_t_12)(PyObject *);
|
||||||
int __pyx_t_13;
|
double __pyx_t_13;
|
||||||
int __pyx_t_14;
|
int __pyx_t_14;
|
||||||
int __pyx_t_15;
|
int __pyx_t_15;
|
||||||
int __pyx_t_16;
|
int __pyx_t_16;
|
||||||
int __pyx_t_17;
|
|
||||||
int __pyx_t_18;
|
|
||||||
int __pyx_lineno = 0;
|
int __pyx_lineno = 0;
|
||||||
const char *__pyx_filename = NULL;
|
const char *__pyx_filename = NULL;
|
||||||
int __pyx_clineno = 0;
|
int __pyx_clineno = 0;
|
||||||
|
|
@ -1702,7 +1817,7 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_2triang_to_flat(CYTHON_
|
||||||
* for d in range(D):
|
* for d in range(D):
|
||||||
* count = 0 # <<<<<<<<<<<<<<
|
* count = 0 # <<<<<<<<<<<<<<
|
||||||
* for m in range(M):
|
* for m in range(M):
|
||||||
* for mm in range(m):
|
* for mm in range(m+1):
|
||||||
*/
|
*/
|
||||||
__pyx_v_count = 0;
|
__pyx_v_count = 0;
|
||||||
|
|
||||||
|
|
@ -1710,78 +1825,188 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_2triang_to_flat(CYTHON_
|
||||||
* for d in range(D):
|
* for d in range(D):
|
||||||
* count = 0
|
* count = 0
|
||||||
* for m in range(M): # <<<<<<<<<<<<<<
|
* for m in range(M): # <<<<<<<<<<<<<<
|
||||||
* for mm in range(m):
|
* for mm in range(m+1):
|
||||||
* flat[count,d] = L[m, mm, d]
|
* flat[count,d] = L[m, mm, d]
|
||||||
*/
|
*/
|
||||||
__pyx_t_9 = __pyx_v_M;
|
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_M); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__pyx_v_m = __pyx_t_10;
|
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_3);
|
||||||
|
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
|
||||||
|
__Pyx_GIVEREF(__pyx_t_1);
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
||||||
|
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
|
||||||
|
__pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
|
||||||
|
__pyx_t_10 = NULL;
|
||||||
|
} else {
|
||||||
|
__pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_3);
|
||||||
|
__pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
}
|
||||||
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
for (;;) {
|
||||||
|
if (likely(!__pyx_t_10)) {
|
||||||
|
if (likely(PyList_CheckExact(__pyx_t_3))) {
|
||||||
|
if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break;
|
||||||
|
#if CYTHON_COMPILING_IN_CPYTHON
|
||||||
|
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#else
|
||||||
|
__pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
|
||||||
|
#if CYTHON_COMPILING_IN_CPYTHON
|
||||||
|
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#else
|
||||||
|
__pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
__pyx_t_1 = __pyx_t_10(__pyx_t_3);
|
||||||
|
if (unlikely(!__pyx_t_1)) {
|
||||||
|
PyObject* exc_type = PyErr_Occurred();
|
||||||
|
if (exc_type) {
|
||||||
|
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
|
||||||
|
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
}
|
||||||
|
__Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_1);
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":37
|
/* "GPy/util/choleskies_cython.pyx":37
|
||||||
* count = 0
|
* count = 0
|
||||||
* for m in range(M):
|
* for m in range(M):
|
||||||
* for mm in range(m): # <<<<<<<<<<<<<<
|
* for mm in range(m+1): # <<<<<<<<<<<<<<
|
||||||
* flat[count,d] = L[m, mm, d]
|
* flat[count,d] = L[m, mm, d]
|
||||||
* count += 1
|
* count += 1
|
||||||
*/
|
*/
|
||||||
__pyx_t_11 = __pyx_v_m;
|
__pyx_t_1 = PyNumber_Add(__pyx_v_m, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__pyx_v_mm = __pyx_t_12;
|
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_2);
|
||||||
|
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
|
||||||
|
__Pyx_GIVEREF(__pyx_t_1);
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||||
|
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
|
||||||
|
__pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0;
|
||||||
|
__pyx_t_12 = NULL;
|
||||||
|
} else {
|
||||||
|
__pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_2);
|
||||||
|
__pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
}
|
||||||
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
for (;;) {
|
||||||
|
if (likely(!__pyx_t_12)) {
|
||||||
|
if (likely(PyList_CheckExact(__pyx_t_2))) {
|
||||||
|
if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_2)) break;
|
||||||
|
#if CYTHON_COMPILING_IN_CPYTHON
|
||||||
|
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#else
|
||||||
|
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
|
||||||
|
#if CYTHON_COMPILING_IN_CPYTHON
|
||||||
|
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#else
|
||||||
|
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
__pyx_t_1 = __pyx_t_12(__pyx_t_2);
|
||||||
|
if (unlikely(!__pyx_t_1)) {
|
||||||
|
PyObject* exc_type = PyErr_Occurred();
|
||||||
|
if (exc_type) {
|
||||||
|
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
|
||||||
|
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
}
|
||||||
|
__Pyx_XDECREF_SET(__pyx_v_mm, __pyx_t_1);
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":38
|
/* "GPy/util/choleskies_cython.pyx":38
|
||||||
* for m in range(M):
|
* for m in range(M):
|
||||||
* for mm in range(m):
|
* for mm in range(m+1):
|
||||||
* flat[count,d] = L[m, mm, d] # <<<<<<<<<<<<<<
|
* flat[count,d] = L[m, mm, d] # <<<<<<<<<<<<<<
|
||||||
* count += 1
|
* count += 1
|
||||||
* return flat
|
* return flat
|
||||||
*/
|
*/
|
||||||
__pyx_t_13 = __pyx_v_m;
|
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__pyx_t_14 = __pyx_v_mm;
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_GOTREF(__pyx_t_5);
|
||||||
|
__Pyx_INCREF(__pyx_v_m);
|
||||||
|
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_m);
|
||||||
|
__Pyx_GIVEREF(__pyx_v_m);
|
||||||
|
__Pyx_INCREF(__pyx_v_mm);
|
||||||
|
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_mm);
|
||||||
|
__Pyx_GIVEREF(__pyx_v_mm);
|
||||||
|
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_1);
|
||||||
|
__Pyx_GIVEREF(__pyx_t_1);
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
__pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_L), __pyx_t_5); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
||||||
|
__pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
__pyx_t_14 = __pyx_v_count;
|
||||||
__pyx_t_15 = __pyx_v_d;
|
__pyx_t_15 = __pyx_v_d;
|
||||||
__pyx_t_16 = -1;
|
__pyx_t_16 = -1;
|
||||||
if (__pyx_t_13 < 0) {
|
|
||||||
__pyx_t_13 += __pyx_pybuffernd_L.diminfo[0].shape;
|
|
||||||
if (unlikely(__pyx_t_13 < 0)) __pyx_t_16 = 0;
|
|
||||||
} else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_L.diminfo[0].shape)) __pyx_t_16 = 0;
|
|
||||||
if (__pyx_t_14 < 0) {
|
if (__pyx_t_14 < 0) {
|
||||||
__pyx_t_14 += __pyx_pybuffernd_L.diminfo[1].shape;
|
__pyx_t_14 += __pyx_pybuffernd_flat.diminfo[0].shape;
|
||||||
if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 1;
|
if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0;
|
||||||
} else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_L.diminfo[1].shape)) __pyx_t_16 = 1;
|
} else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_flat.diminfo[0].shape)) __pyx_t_16 = 0;
|
||||||
if (__pyx_t_15 < 0) {
|
if (__pyx_t_15 < 0) {
|
||||||
__pyx_t_15 += __pyx_pybuffernd_L.diminfo[2].shape;
|
__pyx_t_15 += __pyx_pybuffernd_flat.diminfo[1].shape;
|
||||||
if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 2;
|
if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
|
||||||
} else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_L.diminfo[2].shape)) __pyx_t_16 = 2;
|
} else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_flat.diminfo[1].shape)) __pyx_t_16 = 1;
|
||||||
if (unlikely(__pyx_t_16 != -1)) {
|
if (unlikely(__pyx_t_16 != -1)) {
|
||||||
__Pyx_RaiseBufferIndexError(__pyx_t_16);
|
__Pyx_RaiseBufferIndexError(__pyx_t_16);
|
||||||
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
}
|
}
|
||||||
__pyx_t_16 = __pyx_v_count;
|
*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_flat.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_flat.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_flat.diminfo[1].strides) = __pyx_t_13;
|
||||||
__pyx_t_17 = __pyx_v_d;
|
|
||||||
__pyx_t_18 = -1;
|
|
||||||
if (__pyx_t_16 < 0) {
|
|
||||||
__pyx_t_16 += __pyx_pybuffernd_flat.diminfo[0].shape;
|
|
||||||
if (unlikely(__pyx_t_16 < 0)) __pyx_t_18 = 0;
|
|
||||||
} else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_flat.diminfo[0].shape)) __pyx_t_18 = 0;
|
|
||||||
if (__pyx_t_17 < 0) {
|
|
||||||
__pyx_t_17 += __pyx_pybuffernd_flat.diminfo[1].shape;
|
|
||||||
if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 1;
|
|
||||||
} else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_flat.diminfo[1].shape)) __pyx_t_18 = 1;
|
|
||||||
if (unlikely(__pyx_t_18 != -1)) {
|
|
||||||
__Pyx_RaiseBufferIndexError(__pyx_t_18);
|
|
||||||
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
||||||
}
|
|
||||||
*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_flat.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_flat.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_flat.diminfo[1].strides) = (*__Pyx_BufPtrStrided3d(double *, __pyx_pybuffernd_L.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_L.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_L.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_L.diminfo[2].strides));
|
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":39
|
/* "GPy/util/choleskies_cython.pyx":39
|
||||||
* for mm in range(m):
|
* for mm in range(m+1):
|
||||||
* flat[count,d] = L[m, mm, d]
|
* flat[count,d] = L[m, mm, d]
|
||||||
* count += 1 # <<<<<<<<<<<<<<
|
* count += 1 # <<<<<<<<<<<<<<
|
||||||
* return flat
|
* return flat
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
__pyx_v_count = (__pyx_v_count + 1);
|
__pyx_v_count = (__pyx_v_count + 1);
|
||||||
|
|
||||||
|
/* "GPy/util/choleskies_cython.pyx":37
|
||||||
|
* count = 0
|
||||||
|
* for m in range(M):
|
||||||
|
* for mm in range(m+1): # <<<<<<<<<<<<<<
|
||||||
|
* flat[count,d] = L[m, mm, d]
|
||||||
|
* count += 1
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||||
|
|
||||||
|
/* "GPy/util/choleskies_cython.pyx":36
|
||||||
|
* for d in range(D):
|
||||||
|
* count = 0
|
||||||
|
* for m in range(M): # <<<<<<<<<<<<<<
|
||||||
|
* for mm in range(m+1):
|
||||||
|
* flat[count,d] = L[m, mm, d]
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":40
|
/* "GPy/util/choleskies_cython.pyx":40
|
||||||
|
|
@ -1824,6 +2049,8 @@ static PyObject *__pyx_pf_3GPy_4util_17choleskies_cython_2triang_to_flat(CYTHON_
|
||||||
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flat.rcbuffer->pybuffer);
|
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flat.rcbuffer->pybuffer);
|
||||||
__pyx_L2:;
|
__pyx_L2:;
|
||||||
__Pyx_XDECREF((PyObject *)__pyx_v_flat);
|
__Pyx_XDECREF((PyObject *)__pyx_v_flat);
|
||||||
|
__Pyx_XDECREF(__pyx_v_m);
|
||||||
|
__Pyx_XDECREF(__pyx_v_mm);
|
||||||
__Pyx_XGIVEREF(__pyx_r);
|
__Pyx_XGIVEREF(__pyx_r);
|
||||||
__Pyx_RefNannyFinishContext();
|
__Pyx_RefNannyFinishContext();
|
||||||
return __pyx_r;
|
return __pyx_r;
|
||||||
|
|
@ -3875,6 +4102,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
|
||||||
{&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
|
{&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
|
||||||
{&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
|
{&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
|
||||||
{&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
|
{&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
|
||||||
|
{&__pyx_kp_s_Users_james_work_GPy_GPy_util_c, __pyx_k_Users_james_work_GPy_GPy_util_c, sizeof(__pyx_k_Users_james_work_GPy_GPy_util_c), 0, 0, 1, 0},
|
||||||
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
|
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 1},
|
{&__pyx_n_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
|
{&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
|
||||||
|
|
@ -3882,7 +4110,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
|
||||||
{&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
|
{&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
|
{&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_flat_to_triang, __pyx_k_flat_to_triang, sizeof(__pyx_k_flat_to_triang), 0, 0, 1, 1},
|
{&__pyx_n_s_flat_to_triang, __pyx_k_flat_to_triang, sizeof(__pyx_k_flat_to_triang), 0, 0, 1, 1},
|
||||||
{&__pyx_kp_s_home_james_work_GPy_GPy_util_ch, __pyx_k_home_james_work_GPy_GPy_util_ch, sizeof(__pyx_k_home_james_work_GPy_GPy_util_ch), 0, 0, 1, 0},
|
|
||||||
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
|
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_linalg, __pyx_k_linalg, sizeof(__pyx_k_linalg), 0, 0, 1, 1},
|
{&__pyx_n_s_linalg, __pyx_k_linalg, sizeof(__pyx_k_linalg), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
|
{&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
|
||||||
|
|
@ -3897,6 +4124,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
|
||||||
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
|
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_triang_to_flat, __pyx_k_triang_to_flat, sizeof(__pyx_k_triang_to_flat), 0, 0, 1, 1},
|
{&__pyx_n_s_triang_to_flat, __pyx_k_triang_to_flat, sizeof(__pyx_k_triang_to_flat), 0, 0, 1, 1},
|
||||||
{&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
|
{&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
|
||||||
|
{&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
|
||||||
{0, 0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
static int __Pyx_InitCachedBuiltins(void) {
|
static int __Pyx_InitCachedBuiltins(void) {
|
||||||
|
|
@ -3981,14 +4209,14 @@ static int __Pyx_InitCachedConstants(void) {
|
||||||
/* "GPy/util/choleskies_cython.pyx":8
|
/* "GPy/util/choleskies_cython.pyx":8
|
||||||
* from . import linalg
|
* from . import linalg
|
||||||
*
|
*
|
||||||
* def flat_to_triang(np.ndarray[double, ndim=3] flat, int M): # <<<<<<<<<<<<<<
|
* def flat_to_triang(np.ndarray[double, ndim=2] flat, int M): # <<<<<<<<<<<<<<
|
||||||
* """take a matrix N x D and return a M X M x D array where
|
* """take a matrix N x D and return a M X M x D array where
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
__pyx_tuple__8 = PyTuple_Pack(9, __pyx_n_s_flat, __pyx_n_s_M, __pyx_n_s_N, __pyx_n_s_D, __pyx_n_s_count, __pyx_n_s_ret, __pyx_n_s_d, __pyx_n_s_m, __pyx_n_s_mm); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_tuple__8 = PyTuple_Pack(9, __pyx_n_s_flat, __pyx_n_s_M, __pyx_n_s_N, __pyx_n_s_D, __pyx_n_s_count, __pyx_n_s_ret, __pyx_n_s_d, __pyx_n_s_m, __pyx_n_s_mm); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_GOTREF(__pyx_tuple__8);
|
__Pyx_GOTREF(__pyx_tuple__8);
|
||||||
__Pyx_GIVEREF(__pyx_tuple__8);
|
__Pyx_GIVEREF(__pyx_tuple__8);
|
||||||
__pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_james_work_GPy_GPy_util_ch, __pyx_n_s_flat_to_triang, 8, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_james_work_GPy_GPy_util_c, __pyx_n_s_flat_to_triang, 8, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
|
|
||||||
/* "GPy/util/choleskies_cython.pyx":28
|
/* "GPy/util/choleskies_cython.pyx":28
|
||||||
* return ret
|
* return ret
|
||||||
|
|
@ -4000,7 +4228,7 @@ static int __Pyx_InitCachedConstants(void) {
|
||||||
__pyx_tuple__10 = PyTuple_Pack(9, __pyx_n_s_L, __pyx_n_s_M, __pyx_n_s_D, __pyx_n_s_N, __pyx_n_s_count, __pyx_n_s_flat, __pyx_n_s_d, __pyx_n_s_m, __pyx_n_s_mm); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_tuple__10 = PyTuple_Pack(9, __pyx_n_s_L, __pyx_n_s_M, __pyx_n_s_D, __pyx_n_s_N, __pyx_n_s_count, __pyx_n_s_flat, __pyx_n_s_d, __pyx_n_s_m, __pyx_n_s_mm); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_GOTREF(__pyx_tuple__10);
|
__Pyx_GOTREF(__pyx_tuple__10);
|
||||||
__Pyx_GIVEREF(__pyx_tuple__10);
|
__Pyx_GIVEREF(__pyx_tuple__10);
|
||||||
__pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_james_work_GPy_GPy_util_ch, __pyx_n_s_triang_to_flat, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_james_work_GPy_GPy_util_c, __pyx_n_s_triang_to_flat, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_RefNannyFinishContext();
|
__Pyx_RefNannyFinishContext();
|
||||||
return 0;
|
return 0;
|
||||||
__pyx_L1_error:;
|
__pyx_L1_error:;
|
||||||
|
|
@ -4010,6 +4238,7 @@ static int __Pyx_InitCachedConstants(void) {
|
||||||
|
|
||||||
static int __Pyx_InitGlobals(void) {
|
static int __Pyx_InitGlobals(void) {
|
||||||
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
|
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
|
||||||
|
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
return 0;
|
return 0;
|
||||||
__pyx_L1_error:;
|
__pyx_L1_error:;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -4130,7 +4359,7 @@ PyMODINIT_FUNC PyInit_choleskies_cython(void)
|
||||||
*
|
*
|
||||||
* from . import linalg # <<<<<<<<<<<<<<
|
* from . import linalg # <<<<<<<<<<<<<<
|
||||||
*
|
*
|
||||||
* def flat_to_triang(np.ndarray[double, ndim=3] flat, int M):
|
* def flat_to_triang(np.ndarray[double, ndim=2] flat, int M):
|
||||||
*/
|
*/
|
||||||
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
|
@ -4149,7 +4378,7 @@ PyMODINIT_FUNC PyInit_choleskies_cython(void)
|
||||||
/* "GPy/util/choleskies_cython.pyx":8
|
/* "GPy/util/choleskies_cython.pyx":8
|
||||||
* from . import linalg
|
* from . import linalg
|
||||||
*
|
*
|
||||||
* def flat_to_triang(np.ndarray[double, ndim=3] flat, int M): # <<<<<<<<<<<<<<
|
* def flat_to_triang(np.ndarray[double, ndim=2] flat, int M): # <<<<<<<<<<<<<<
|
||||||
* """take a matrix N x D and return a M X M x D array where
|
* """take a matrix N x D and return a M X M x D array where
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -5053,6 +5282,11 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __Pyx_RaiseBufferIndexError(int axis) {
|
||||||
|
PyErr_Format(PyExc_IndexError,
|
||||||
|
"Out of bounds on buffer access (axis %d)", axis);
|
||||||
|
}
|
||||||
|
|
||||||
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
|
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
|
||||||
#if CYTHON_COMPILING_IN_CPYTHON
|
#if CYTHON_COMPILING_IN_CPYTHON
|
||||||
PyObject *tmp_type, *tmp_value, *tmp_tb;
|
PyObject *tmp_type, *tmp_value, *tmp_tb;
|
||||||
|
|
@ -5091,11 +5325,6 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __Pyx_RaiseBufferIndexError(int axis) {
|
|
||||||
PyErr_Format(PyExc_IndexError,
|
|
||||||
"Out of bounds on buffer access (axis %d)", axis);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if PY_MAJOR_VERSION < 3
|
#if PY_MAJOR_VERSION < 3
|
||||||
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
|
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
|
||||||
CYTHON_UNUSED PyObject *cause) {
|
CYTHON_UNUSED PyObject *cause) {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ cimport numpy as np
|
||||||
|
|
||||||
from . import linalg
|
from . import linalg
|
||||||
|
|
||||||
def flat_to_triang(np.ndarray[double, ndim=3] flat, int M):
|
def flat_to_triang(np.ndarray[double, ndim=2] flat, int M):
|
||||||
"""take a matrix N x D and return a M X M x D array where
|
"""take a matrix N x D and return a M X M x D array where
|
||||||
|
|
||||||
N = M(M+1)/2
|
N = M(M+1)/2
|
||||||
|
|
@ -16,11 +16,11 @@ def flat_to_triang(np.ndarray[double, ndim=3] flat, int M):
|
||||||
cdef int N = flat.shape[0]
|
cdef int N = flat.shape[0]
|
||||||
cdef int D = flat.shape[1]
|
cdef int D = flat.shape[1]
|
||||||
cdef int count = 0
|
cdef int count = 0
|
||||||
cdef np.ndarray[double, ndim=2] ret = np.empty((M, M, D))
|
cdef np.ndarray[double, ndim=3] ret = np.zeros((M, M, D))
|
||||||
for d in range(D):
|
for d in range(D):
|
||||||
count = 0
|
count = 0
|
||||||
for m in range(M):
|
for m in range(M):
|
||||||
for mm in range(m):
|
for mm in range(m+1):
|
||||||
ret[m, mm, d] = flat[count,d]
|
ret[m, mm, d] = flat[count,d]
|
||||||
count += 1
|
count += 1
|
||||||
return ret
|
return ret
|
||||||
|
|
@ -34,7 +34,7 @@ def triang_to_flat(np.ndarray[double, ndim=3] L):
|
||||||
for d in range(D):
|
for d in range(D):
|
||||||
count = 0
|
count = 0
|
||||||
for m in range(M):
|
for m in range(M):
|
||||||
for mm in range(m):
|
for mm in range(m+1):
|
||||||
flat[count,d] = L[m, mm, d]
|
flat[count,d] = L[m, mm, d]
|
||||||
count += 1
|
count += 1
|
||||||
return flat
|
return flat
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from GPy.core.parameterization import Parameterized, Param
|
from ..core.parameterization import Parameterized, Param
|
||||||
from ..core.parameterization.transformations import Logexp
|
from ..core.parameterization.transformations import Logexp
|
||||||
|
|
||||||
class WarpingFunction(Parameterized):
|
class WarpingFunction(Parameterized):
|
||||||
|
|
|
||||||
3
setup.py
3
setup.py
|
|
@ -11,7 +11,8 @@ version = '0.6.1'
|
||||||
def read(fname):
|
def read(fname):
|
||||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||||
|
|
||||||
compile_flags = ["-march=native", '-fopenmp', '-O3', ]
|
#compile_flags = ["-march=native", '-fopenmp', '-O3', ]
|
||||||
|
compile_flags = [ '-fopenmp', '-O3', ]
|
||||||
|
|
||||||
ext_mods = [Extension(name='GPy.kern._src.stationary_cython',
|
ext_mods = [Extension(name='GPy.kern._src.stationary_cython',
|
||||||
sources=['GPy/kern/_src/stationary_cython.c','GPy/kern/_src/stationary_utils.c'],
|
sources=['GPy/kern/_src/stationary_cython.c','GPy/kern/_src/stationary_utils.c'],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue