From 5edf464efa69f1457a0e992250da0e5c54a10062 Mon Sep 17 00:00:00 2001 From: James Hensman Date: Mon, 27 Apr 2015 20:15:36 +0100 Subject: [PATCH] help choleskies along a little --- GPy/core/parameterization/index_operations.py | 3 + GPy/util/choleskies.py | 113 +++--------------- 2 files changed, 18 insertions(+), 98 deletions(-) diff --git a/GPy/core/parameterization/index_operations.py b/GPy/core/parameterization/index_operations.py index e4803f37..fd6438ce 100644 --- a/GPy/core/parameterization/index_operations.py +++ b/GPy/core/parameterization/index_operations.py @@ -5,6 +5,8 @@ import numpy from numpy.lib.function_base import vectorize from .lists_and_dicts import IntArrayDict from functools import reduce +from transformations import Transformation +from priors import Prior def extract_properties_to_index(index, props): prop_index = dict() @@ -144,6 +146,7 @@ class ParameterIndexOperations(object): return prop_index def add(self, prop, indices): + #assert isinstance(prop, (Transformation, Prior)), "invalid key" self._properties[prop] = combine_indices(self._properties[prop], indices) def remove(self, prop, indices): diff --git a/GPy/util/choleskies.py b/GPy/util/choleskies.py index 37ac7211..2accfedc 100644 --- a/GPy/util/choleskies.py +++ b/GPy/util/choleskies.py @@ -5,10 +5,7 @@ import numpy as np from . import linalg from .config import config -try: - from scipy import weave -except ImportError: - config.set('weave', 'working', 'False') +import choleskies_cython def safe_root(N): i = np.sqrt(N) @@ -17,36 +14,6 @@ def safe_root(N): raise ValueError("N is not square!") return j -def _flat_to_triang_weave(flat): - """take a matrix N x D and return a M X M x D array where - - 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. - This is the weave implementation - """ - N, D = flat.shape - M = (-1 + safe_root(8*N+1))/2 - ret = np.zeros((M, M, D)) - flat = np.ascontiguousarray(flat) - - code = """ - int count = 0; - for(int m=0; milk', Ki, LL) - #self._loglik = np.sum([np.sum(np.log(np.abs(np.diag()))) for i in range(self.L.shape[-1])]) -#