improve debug helper

This commit is contained in:
Zhenwen Dai 2014-09-01 15:23:41 +01:00
parent 1110cc31e6
commit ca5067c614
2 changed files with 7 additions and 1 deletions

View file

@ -67,6 +67,9 @@ class SparseGP_MPI(SparseGP):
del dc['N_range'] del dc['N_range']
del dc['N_list'] del dc['N_list']
del dc['Y_local'] del dc['Y_local']
if 'normalizer' not in dc:
dc['normalizer'] = None
dc['Y_normalized'] = dc['Y']
return dc return dc
#===================================================== #=====================================================

View file

@ -26,11 +26,14 @@ def checkFullRank(m, tol=1e-10, name=None, force_check=False):
print 'The size of '+name+'is too big to check (>=10000)!' print 'The size of '+name+'is too big to check (>=10000)!'
return True return True
s = np.linalg.eigvals(m) s = np.real(np.linalg.eigvals(m))
if s.min()/s.max()<tol: if s.min()/s.max()<tol:
print name+' is close to singlar!' print name+' is close to singlar!'
print 'The eigen values of '+name+' is '+str(s) print 'The eigen values of '+name+' is '+str(s)
if m.mpi_comm is None or m.mpi_comm.rank==0:
import time
m.pickle('model_'+str(int(time.time()))+'.pickle')
return False return False
return True return True