Skip to content

Commit

Permalink
reduce complextiy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ipuch committed Nov 3, 2023
1 parent b45a891 commit fbb3ea5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions bioptim/optimization/solution/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,11 @@ def concatenate_optimization_variables(
"""
if len(variable[0].shape):
if isinstance(variable[0][0], np.ndarray):
z_final = []
for zi in variable:
z_final.append(concatenate_optimization_variables(zi, continuous_interval))

if merge_phases:
return concatenate_optimization_variables(z_final, continuous_phase)
else:
return z_final
z_final = [concatenate_optimization_variables(zi, continuous_interval) for zi in variable]

return concatenate_optimization_variables(z_final, continuous_phase) if merge_phases else z_final

else:
final_tuple = []
for i, y in enumerate(variable):
Expand Down

0 comments on commit fbb3ea5

Please sign in to comment.