def _safe_svd(A, **kwargs):
 if kwargs.get('overwrite_a', False):
  raise ValueError('Cannot set overwrite_a=True with this function')
 try:
  return linalg.svd(A, **kwargs)
 except np.linalg.LinAlgError as exp:
  from .utils import warn
  if ('lapack_driver' in _get_args(linalg.svd)):
   warn(('SVD error (%s), attempting to use GESVD instead of GESDD' % (exp,)))
   return linalg.svd(A, lapack_driver='gesvd', **kwargs)
  else:
   raise

def _safe_svd ( A , ** kwargs ) : if kwargs . get ( 'overwrite_a' , False ) : raise ValueError ( 'Cannot set overwrite_a=True with this function' ) try : return linalg . svd ( A , ** kwargs ) except np . linalg . LinAlgError as exp : from . utils import warn if ( 'lapack_driver' in _get_args ( linalg . svd ) ) : warn ( ( 'SVD error (%s), attempting to use GESVD instead of GESDD' % ( exp , ) ) ) return linalg . svd ( A , lapack_driver = 'gesvd' , ** kwargs ) else : raise
wrapper to get around the svd did not converge error of death .