mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-30 14:35:15 +02:00
Bug in linalg jitchol!!!
This commit is contained in:
parent
7fbbdafdbf
commit
29d153e185
2 changed files with 41 additions and 6 deletions
|
|
@ -82,6 +82,7 @@ def force_F_ordered(A):
|
|||
|
||||
# return jitchol(A+np.eye(A.shape[0])*jitter, maxtries-1)
|
||||
|
||||
|
||||
def jitchol(A, maxtries=5):
|
||||
A = np.ascontiguousarray(A)
|
||||
L, info = lapack.dpotrf(A, lower=1)
|
||||
|
|
@ -92,13 +93,16 @@ def jitchol(A, maxtries=5):
|
|||
if np.any(diagA <= 0.):
|
||||
raise linalg.LinAlgError, "not pd: non-positive diagonal elements"
|
||||
jitter = diagA.mean() * 1e-6
|
||||
while maxtries > 0 and np.isfinite(jitter):
|
||||
num_tries = 0
|
||||
while num_tries < maxtries and np.isfinite(jitter):
|
||||
try:
|
||||
print jitter
|
||||
L = linalg.cholesky(A + np.eye(A.shape[0]) * jitter, lower=True)
|
||||
return L
|
||||
except:
|
||||
jitter *= 10
|
||||
finally:
|
||||
maxtries -= 1
|
||||
num_tries += 1
|
||||
raise linalg.LinAlgError, "not positive definite, even with jitter."
|
||||
import traceback
|
||||
try: raise
|
||||
|
|
@ -108,10 +112,6 @@ def jitchol(A, maxtries=5):
|
|||
import ipdb;ipdb.set_trace()
|
||||
return L
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# def dtrtri(L, lower=1):
|
||||
# """
|
||||
# Wrapper for lapack dtrtri function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue