mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-21 14:05:14 +02:00
Changed the order of the operations, ensuring that the covariance matrix is symmetric despite numerical precision issues.
Suggested by Alan.
This commit is contained in:
parent
b1935292d9
commit
a2f67febb4
1 changed files with 1 additions and 1 deletions
|
|
@ -135,7 +135,7 @@ class Stationary(Kern):
|
||||||
#X2, = self._slice_X(X2)
|
#X2, = self._slice_X(X2)
|
||||||
X1sq = np.sum(np.square(X),1)
|
X1sq = np.sum(np.square(X),1)
|
||||||
X2sq = np.sum(np.square(X2),1)
|
X2sq = np.sum(np.square(X2),1)
|
||||||
r2 = -2.*np.dot(X, X2.T) + X1sq[:,None] + X2sq[None,:]
|
r2 = -2.*np.dot(X, X2.T) + (X1sq[:,None] + X2sq[None,:])
|
||||||
r2 = np.clip(r2, 0, np.inf)
|
r2 = np.clip(r2, 0, np.inf)
|
||||||
return np.sqrt(r2)
|
return np.sqrt(r2)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue