Hey everyone
I have a two all my cost functions have in common one rather performance expensive "buildup" of an object based on parameters they share. I wanted to know wether it is possible to have this object have built up once and share it between the different cost functions.
My code looks something like this:
struct C1{
//...
bool operator()(T const* const* parameters, T* residuals) const{
auto instance = reference->WithParameters(parameters[0]);
struct C1{
//...
bool operator()(T const* const* parameters, T* residuals) const{
auto instance = reference->WithParameters(parameters[0]);
Is there a way to have the instance computed just once every cycle?