<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> def checkFinite ( arr , name = None ) : <EOL> if name is None : <EOL> name = '<STR_LIT>' + str ( id ( arr ) ) + '<STR_LIT:]>' <EOL> if np . any ( np . logical_not ( np . isfinite ( arr ) ) ) : <EOL> idx = np . where ( np . logical_not ( np . isfinite ( arr ) ) ) [ <NUM_LIT:0> ] <EOL> print ( name + '<STR_LIT>' + str ( idx ) + '<STR_LIT>' + str ( arr [ idx ] ) + '<STR_LIT:!>' ) <EOL> return False <EOL> return True <EOL> def checkFullRank ( m , tol = <NUM_LIT> , name = None , force_check = False ) : <EOL> if name is None : <EOL> name = '<STR_LIT>' + str ( id ( m ) ) + '<STR_LIT:]>' <EOL> assert len ( m . shape ) == <NUM_LIT:2> and m . shape [ <NUM_LIT:0> ] == m . shape [ <NUM_LIT:1> ] , '<STR_LIT>' <EOL> if not force_check and m . shape [ <NUM_LIT:0> ] >= <NUM_LIT> : <EOL> print ( '<STR_LIT>' + name + '<STR_LIT>' ) <EOL> return True <EOL> s = np . real ( np . linalg . eigvals ( m ) ) <EOL> if s . min ( ) / s . max ( ) < tol : <EOL> print ( name + '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' + name + '<STR_LIT>' + str ( s ) ) <EOL> return False <EOL> return True </s>
