fixed trace_dot to be a litle faster...

This commit is contained in:
James Hensman 2013-03-12 12:20:46 +00:00
parent ba78e720f2
commit 0503d0e3f5
2 changed files with 2 additions and 3 deletions

View file

@ -204,7 +204,7 @@ class opt_scg(Optimizer):
def opt(self, f_fp = None, f = None, fp = None):
assert not f is None
assert not fp is None
opt_result = SCG (f,fp,self.x_init, display=self.messages,
opt_result = SCG (f,fp,self.x_init, display=self.messages)
def get_optimizer(f_min):
# import rasmussens_minimize as rasm

View file

@ -18,8 +18,7 @@ def trace_dot(a,b):
"""
efficiently compute the trace of the matrix product of a and b
"""
assert a.shape==b.T.shape
return np.dot(a.flatten(),b.T.flatten())
return np.sum(a*b)
def mdot(*args):
"""Multiply all the arguments using matrix product rules.