Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
MAINT: Clean up optimize.zeros C solvers interfaces/code. #9465
Split data being passed to zeros C solvers into const/modifiable parts.
In optimize.zeros, the C solvers were being passed a scipy_zeros_parameters
…le parts. Refactored to remove an unneeded jmp_buf object. Added volatile qualifier to a object used after a longjmp() return. In optimize.zeros, the C solvers were being passed a scipy_zeros_parameters struct disguised as a default_parameters struct. The initial elements of the scipy_zeros_parameters contained the same elements as the default_parameters, and pointers to default_parameters were being upcast to scipy_zeros_parameters. However these two structs were not linked either in code or documentation. This change separates the data needed to evaluate the function from the statistics collected during the solving of the equation. This also makes for easier initialization and cleaner separation of input and output data. Ensure the solver_stats->error_num is set for all return paths. The jmp_buf does not need to be copied if it is constructed in place. A PyTuple is being created and then destroyed in both branches after a setjmp() return, hence needs a volatile qualifier.