#NEWLINE# def create_task_list( D , calc_second_order , n_processors ) : #NEWLINE# #INDENT# tasks_first_order = [ [ d , j , None ] for j in range ( D ) for d in ( 'S1' , 'S1_conf' , 'ST' , 'ST_conf' ) ] #NEWLINE# tasks_second_order = [ ] #NEWLINE# if calc_second_order : #NEWLINE# #INDENT# tasks_second_order = [ [ d , j , k ] for j in range ( D ) for k in range ( ( j + 1 ) , D ) for d in ( 'S2' , 'S2_conf' ) ] #NEWLINE# #UNINDENT# if ( n_processors is None ) : #NEWLINE# #INDENT# n_processors = min ( cpu_count ( ) , ( len ( tasks_first_order ) + len ( tasks_second_order ) ) ) #NEWLINE# #UNINDENT# if ( not calc_second_order ) : #NEWLINE# #INDENT# tasks = np . array_split ( tasks_first_order , j ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tasks = np . array_split ( [ v for v in sum ( zip_longest ( tasks_first_order [ : : ( - 1 ) ] , tasks_second_order ) , ( ) ) if ( v is not None ) ] , n_processors ) #NEWLINE# #UNINDENT# return ( tasks , n_processors )