From 08ed72b2f234ed292e6628469e5c7b45b7532bb8 Mon Sep 17 00:00:00 2001 From: Zhenwen Dai Date: Tue, 24 Jun 2014 18:01:16 +0100 Subject: [PATCH] fix the speed problem of the tie framework --- GPy/core/parameterization/ties_and_remappings.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GPy/core/parameterization/ties_and_remappings.py b/GPy/core/parameterization/ties_and_remappings.py index 61c40a8e..b2330d59 100644 --- a/GPy/core/parameterization/ties_and_remappings.py +++ b/GPy/core/parameterization/ties_and_remappings.py @@ -70,7 +70,12 @@ class Tie(Remapping): #more than one of the tied things changed. panic. raise ValueError, "something is wrong with the tieing" def parameters_changed(self): - super(Tie,self).parameters_changed() + #ensure all out parameters have the correct value, as specified by our mapping + index = self._highest_parent_.constraints[self] + if (self._highest_parent_.param_array[index]==self.value).all(): + return # STOP TRIGGER THE UPDATE LOOP MULTIPLE TIMES!!! + self._highest_parent_.param_array[index] = self.mapping() + [p.notify_observers(which=self) for p in self.tied_parameters] self.collate_gradient() def mapping(self):