mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-03 16:52:39 +02:00
added trace_sum for efficiency
This commit is contained in:
parent
129bb3924e
commit
cb082898d3
2 changed files with 10 additions and 3 deletions
|
|
@ -14,6 +14,13 @@ import types
|
|||
#import scipy.lib.lapack.flapack
|
||||
import scipy as sp
|
||||
|
||||
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())
|
||||
|
||||
def mdot(*args):
|
||||
"""Multiply all the arguments using matrix product rules.
|
||||
The output is equivalent to multiplying the arguments one by one
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue