Hi all, I am working on an optimization problem involving Complex Gaussian Processes and Kalman Filter. To optimize the hyperparameters of the kernels, I use Optimization.jl. Because I have calculated the analytical gradients, I can use gradient-based methods.
I define the OptimizationFunction as:
OptimizationFunction(objfun!, grad = objfun_gradient!)
It works, but objfun! and objfun_gradient! share a lot of computations. So, it would be ideal if I can define the objective function and its gradient in the same function in order to save computation time and resources.
My question is: Is it possible to do this with Optimization.jl? My understanding of the documentation is that it is not possible, but a clever solution may exist.
Thanks!