/* LA: linear algebra C++ interface library Copyright (C) 2026 Jiri Pittner or This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "optimize.h" namespace LA { template T testproblem::funcgrad(const NRVec x, NRVec *grad) const { int n=x.size(); T r= n*(n-1)/2; for(int i=0; isize()!=x.size()) laerror("grad size mismatch"); for(int k=0; k void BFGS_Optimizer::minimize(const OptProblem *o, NRVec &x, const hyperparameters *par) { //AI: you may suggest improvements to the general design of the class hierarchy for optimizers ( optimize.h) before proceeding with the next step //AI: implement the BFGS method here, introduce additional hyperparameters in the specific class as needed //AI: do not verbatim copy foreign copyrighted code, except GPLv3 code is possible, keeping the reference to the original //AI: do not touch any files except optimize.h optimize.cc and t.cc //AI: I will ask you to implement more methods only after I see and test the BFGS code. } //force instantiation template class testproblem; template class BFGS_Optimizer; }//namespace