2 #include "Identifiable.hpp"
3 #include "heterogeneous.hpp"
5 #include "qcor_observable.hpp"
11 class ObjectiveFunction;
16 using GradientFunctionType =
17 std::function<std::vector<double>(
const std::vector<double> &,
double)>;
20 GradientFunctionType gradient_func;
25 std::vector<double> operator()(
const std::vector<double> &x,
27 return gradient_func(x, current_val);
31 namespace __internal__ {
32 extern std::string DEFAULT_GRADIENT_METHOD;
33 std::shared_ptr<GradientFunction>
34 get_gradient_method(
const std::string &type,
35 std::shared_ptr<ObjectiveFunction> obj_func,
36 xacc::HeterogeneousMap options = {});
38 std::shared_ptr<GradientFunction>
39 get_gradient_method(
const std::string &type,
40 std::function<std::shared_ptr<CompositeInstruction>(
52 public xacc::Identifiable {
54 virtual void initialize(std::shared_ptr<ObjectiveFunction> obj_func,
55 xacc::HeterogeneousMap &&options = {}) = 0;
57 initialize(std::function<std::shared_ptr<CompositeInstruction>(
60 Operator &obs, xacc::HeterogeneousMap &&options = {}) = 0;