def _KNV0_loop(ker_pole, transfer_matrix, poles, B, maxiter, rtol):
 stop = False
 nb_try = 0
 while ((nb_try < maxiter) and (not stop)):
  det_transfer_matrixb = np.abs(np.linalg.det(transfer_matrix))
  for j in range(B.shape[0]):
   _KNV0(B, ker_pole, transfer_matrix, j, poles)
  det_transfer_matrix = np.max((np.sqrt(np.spacing(1)), np.abs(np.linalg.det(transfer_matrix))))
  cur_rtol = np.abs(((det_transfer_matrix - det_transfer_matrixb) / det_transfer_matrix))
  if ((cur_rtol < rtol) and (det_transfer_matrix > np.sqrt(np.spacing(1)))):
   stop = True
  nb_try += 1
 return (stop, cur_rtol, nb_try)

def _KNV0_loop ( ker_pole , transfer_matrix , poles , B , maxiter , rtol ) : stop = False nb_try = 0 while ( ( nb_try < maxiter ) and ( not stop ) ) : det_transfer_matrixb = np . abs ( np . linalg . det ( transfer_matrix ) ) for j in range ( B . shape [ 0 ] ) : _KNV0 ( B , ker_pole , transfer_matrix , j , poles ) det_transfer_matrix = np . max ( ( np . sqrt ( np . spacing ( 1 ) ) , np . abs ( np . linalg . det ( transfer_matrix ) ) ) ) cur_rtol = np . abs ( ( ( det_transfer_matrix - det_transfer_matrixb ) / det_transfer_matrix ) ) if ( ( cur_rtol < rtol ) and ( det_transfer_matrix > np . sqrt ( np . spacing ( 1 ) ) ) ) : stop = True nb_try += 1 return ( stop , cur_rtol , nb_try )
loop over all poles one by one and apply knv method 0 algorithm .