Skip to content

Commit

Permalink
Merge bd11946 into 0e55033
Browse files Browse the repository at this point in the history
  • Loading branch information
bwengals committed Mar 3, 2017
2 parents 0e55033 + bd11946 commit 126b701
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pymc3/gp/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,14 @@ def square_dist(self, X, Z):
X = tt.mul(X, 1.0 / self.lengthscales)
Xs = tt.sum(tt.square(X), 1)
if Z is None:
return -2.0 * tt.dot(X, tt.transpose(X)) +\
(tt.reshape(Xs, (-1, 1)) + tt.reshape(Xs, (1, -1)))
sqd = -2.0 * tt.dot(X, tt.transpose(X)) +\
(tt.reshape(Xs, (-1, 1)) + tt.reshape(Xs, (1, -1)))
else:
Z = tt.mul(Z, 1.0 / self.lengthscales)
Zs = tt.sum(tt.square(Z), 1)
return -2.0 * tt.dot(X, tt.transpose(Z)) +\
(tt.reshape(Xs, (-1, 1)) + tt.reshape(Zs, (1, -1)))
sqd = -2.0 * tt.dot(X, tt.transpose(Z)) +\
(tt.reshape(Xs, (-1, 1)) + tt.reshape(Zs, (1, -1)))
return tt.clip(sqd, 0.0, np.inf)

def euclidean_dist(self, X, Z):
r2 = self.square_dist(X, Z)
Expand Down

0 comments on commit 126b701

Please sign in to comment.