13 #ifndef XACC_ALGORITHM_RBM_CLASSIFICATION_DWAVE_DATAEXP_HPP_ 14 #define XACC_ALGORITHM_RBM_CLASSIFICATION_DWAVE_DATAEXP_HPP_ 16 #include "rbm_classification.hpp" 24 const std::string
name()
const override {
return "dwave-exp"; }
26 std::tuple<Eigen::MatrixXd, Eigen::VectorXd, Eigen::VectorXd>
27 compute(Eigen::MatrixXd &features, Eigen::MatrixXd &w, Eigen::VectorXd &v,
46 auto qpu = xacc::getAccelerator(
"dwave");
47 auto provider = xacc::getIRProvider(
"quantum");
48 auto qubo = xacc::ir::asComposite(provider->createInstruction(
"rbm", {}));
49 int nv = qubo->getParameter(0).as<
int>();
50 int nh = qubo->getParameter(1).as<
int>();
52 std::vector<double> evaled_params(nv + nh + nv*nh);
53 for (
int i = 0; i < nv; i++) {
54 evaled_params[i] = v(i);
56 for (
int i = nv; i < nv+nh; i++) {
57 evaled_params[i] = h(i);
60 auto w_vec = w.data();
61 for (
int i = nv+nh; i <nv+nh+nv*nh ; i++) {
62 evaled_params[i] = w_vec[i];
65 auto evaled_qubo = (*qubo)(evaled_params);
67 auto buffer = xacc::qalloc();
68 qpu->execute(buffer, evaled_qubo);
Definition: Accelerator.hpp:25
Definition: dwave_expectation_strategy.hpp:22
Definition: rbm_classification.hpp:24
const std::string name() const override
Definition: dwave_expectation_strategy.hpp:24
Definition: heterogeneous.hpp:45
const std::string description() const override
Definition: dwave_expectation_strategy.hpp:25