LLNL / Juqbox.jl

Juqbox.jl solves quantum optimal control problems in closed quantum systems
MIT License
42 stars 10 forks source link

Initialize working arrays inside params constructor. #30

Closed steffi7574 closed 1 year ago

steffi7574 commented 1 year ago

Previously, the working arrays were initialized only during IpOpt setup (i.e. when run_optimizer is called). However they might be needed without the call to run_optimizer, e.g. when plot_results is called on the initial pcof0 vector. Hence, initializing them inside the params constructor ensures that they are always availble.

Note: This pull request changes the interface for constructing the params struct (::objparams): the constructor needs to know the length of the pcof vector, hence 'nCoeff' should be passed to the constructor.