Merge pull request #574 from alansaul/lyapunov_fix

Fixing scipy=1.0.0 incompatibility of lyapunov discovered in PR #573. Coverage issue should be resolved by PR #575.
This commit is contained in:
Alan Saul 2017-11-16 09:59:01 +00:00 committed by GitHub
commit 4e1b7dfad4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -9,6 +9,10 @@ from .stationary import RatQuad
import numpy as np import numpy as np
import scipy as sp 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): class sde_RBF(RBF):
""" """
@ -67,7 +71,7 @@ class sde_RBF(RBF):
H[0,0] = 1 H[0,0] = 1
# Infinite covariance: # 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) Pinf = 0.5*(Pinf + Pinf.T)
# Allocating space for derivatives # Allocating space for derivatives
dF = np.empty([F.shape[0],F.shape[1],2]) dF = np.empty([F.shape[0],F.shape[1],2])

View file

@ -11,6 +11,10 @@ from .stationary import RatQuad
import numpy as np import numpy as np
import scipy as sp 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): class sde_RBF(RBF):
""" """
@ -69,7 +73,7 @@ class sde_RBF(RBF):
H[0,0] = 1 H[0,0] = 1
# Infinite covariance: # 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) Pinf = 0.5*(Pinf + Pinf.T)
# Allocating space for derivatives # Allocating space for derivatives
dF = np.empty([F.shape[0],F.shape[1],2]) dF = np.empty([F.shape[0],F.shape[1],2])