#NEWLINE# @ classmethod #NEWLINE# def _refine_complexes( cls , complexes ) : #NEWLINE# #INDENT# 'return complexes such that no bounding rectangles of non-conjugate\n        roots would intersect if slid horizontally or vertically/\n        ' #NEWLINE# while complexes : #NEWLINE# #INDENT# for ( i , ( u , f , k ) ) in enumerate ( complexes ) : #NEWLINE# #INDENT# for ( j , ( v , g , m ) ) in enumerate ( complexes [ ( i + 1 ) : ] ) : #NEWLINE# #INDENT# ( u , v ) = u . refine_disjoint ( v ) #NEWLINE# complexes [ ( ( i + j ) + 1 ) ] = ( v , g , m ) #NEWLINE# #UNINDENT# complexes [ i ] = ( u , f , k ) #NEWLINE# #UNINDENT# N = ( ( len ( complexes ) // 2 ) - 1 ) #NEWLINE# uu = set ( [ ( u . ax , u . bx ) for ( u , _ , _ ) in complexes ] ) #NEWLINE# u = uu . pop ( ) #NEWLINE# if ( sum ( [ ( ( u [ 1 ] <= v [ 0 ] ) or ( v [ 1 ] <= u [ 0 ] ) ) for v in uu ] ) < N ) : #NEWLINE# #INDENT# for ( i , ( u , f , k ) ) in enumerate ( complexes ) : #NEWLINE# #INDENT# u = u . _inner_refine ( ) #NEWLINE# complexes [ i ] = ( u , f , k ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# return complexes