13 #ifndef XACC_ALGORITHM_DDCL_HPP_ 14 #define XACC_ALGORITHM_DDCL_HPP_ 16 #include "Algorithm.hpp" 21 using Circuit = std::shared_ptr<CompositeInstruction>;
22 using Counts = std::map<std::string, int>;
26 virtual std::pair<double, std::vector<double>>
27 compute(Counts &counts,
const std::vector<double> &target,
const HeterogeneousMap& options = {}) = 0;
29 virtual bool isValidGradientStrategy(
const std::string &gradientStrategy) = 0;
37 virtual std::vector<Circuit>
38 getCircuitExecutions(Circuit circuit,
const std::vector<double> &x) = 0;
39 virtual void compute(std::vector<double> &grad, std::vector<std::shared_ptr<AcceleratorBuffer>> results,
40 const std::vector<double> &q_dist,
41 const std::vector<double> &target_dist) = 0;
47 getCircuitExecutions(Circuit circuit,
const std::vector<double> &x)
override {
50 void compute(std::vector<double> &grad, std::vector<std::shared_ptr<AcceleratorBuffer>> results,
51 const std::vector<double> &q_dist,
52 const std::vector<double> &target_dist)
override {
55 const std::string
name()
const override {
return "null-gs"; }
61 std::shared_ptr<Optimizer> optimizer;
62 std::shared_ptr<CompositeInstruction> kernel;
63 std::shared_ptr<Accelerator> accelerator;
64 std::vector<double> initial_params;
65 std::vector<double> target_dist;
68 bool persistBuffer =
false;
74 const std::vector<std::string> requiredParameters()
const override;
76 void execute(
const std::shared_ptr<AcceleratorBuffer> buffer)
const override;
77 std::vector<double> execute(
const std::shared_ptr<AcceleratorBuffer> buffer,
78 const std::vector<double> ¶meters)
override;
79 const std::string
name()
const override {
return "ddcl"; }
82 DEFINE_ALGORITHM_CLONE(
DDCL)
Definition: Algorithm.hpp:34
Definition: Accelerator.hpp:25
const std::string name() const override
Definition: ddcl.hpp:55
Definition: heterogeneous.hpp:45
const std::string name() const override
Definition: ddcl.hpp:79
Definition: Identifiable.hpp:25
const std::string description() const override
Definition: ddcl.hpp:80
const std::string description() const override
Definition: ddcl.hpp:56