From a881e3da0419751aee2070a7fc19e45d888109f0 Mon Sep 17 00:00:00 2001 From: Alan Saul Date: Tue, 14 Nov 2017 16:41:55 +0000 Subject: [PATCH] Updated sde_kern to work with scipy=1.0.0 --- GPy/kern/_src/sde_stationary.py | 6 +++++- GPy/kern/src/sde_stationary.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/GPy/kern/_src/sde_stationary.py b/GPy/kern/_src/sde_stationary.py index 9504c5c3..aeb77010 100644 --- a/GPy/kern/_src/sde_stationary.py +++ b/GPy/kern/_src/sde_stationary.py @@ -9,6 +9,10 @@ from .stationary import RatQuad import numpy as np import scipy as sp +try: + from scipy.linalg import solve_continuous_lyapunov as lyap +except ImportError: + from scipy.linalg import solve_lyapunov as lyap class sde_RBF(RBF): """ @@ -67,7 +71,7 @@ class sde_RBF(RBF): H[0,0] = 1 # Infinite covariance: - Pinf = sp.linalg.solve_lyapunov(F, -np.dot(L,np.dot( Qc[0,0],L.T))) + Pinf = lyap(F, -np.dot(L,np.dot( Qc[0,0],L.T))) Pinf = 0.5*(Pinf + Pinf.T) # Allocating space for derivatives dF = np.empty([F.shape[0],F.shape[1],2]) diff --git a/GPy/kern/src/sde_stationary.py b/GPy/kern/src/sde_stationary.py index 3ac5f402..ae3dd89c 100644 --- a/GPy/kern/src/sde_stationary.py +++ b/GPy/kern/src/sde_stationary.py @@ -11,6 +11,10 @@ from .stationary import RatQuad import numpy as np import scipy as sp +try: + from scipy.linalg import solve_continuous_lyapunov as lyap +except ImportError: + from scipy.linalg import solve_lyapunov as lyap class sde_RBF(RBF): """ @@ -69,7 +73,7 @@ class sde_RBF(RBF): H[0,0] = 1 # Infinite covariance: - Pinf = sp.linalg.solve_lyapunov(F, -np.dot(L,np.dot( Qc[0,0],L.T))) + Pinf = lyap(F, -np.dot(L,np.dot( Qc[0,0],L.T))) Pinf = 0.5*(Pinf + Pinf.T) # Allocating space for derivatives dF = np.empty([F.shape[0],F.shape[1],2])