Commit c4fddfed authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

small cleanup

parent fb637ac7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -20,10 +20,10 @@ int main(int argc, char **argv) {
  auto optimizer = createOptimizer("nlopt");

  // Optimize the above function
  auto result = optimizer->optimize(*objective.get());
  auto [optval, opt_params] = optimizer->optimize(*objective.get());

  // Print the result
  printf("energy = %f\n", result.first);
  printf("energy = %f\n", optval);

  return 0;
}
+2 −2
Original line number Diff line number Diff line
@@ -205,11 +205,11 @@ void StaqTokenCollector::collect(clang::Preprocessor &PP,
    }
  }

  std::cout << "FROM STAQ:\n" << sss.str() << "\n";
  // std::cout << "FROM STAQ:\n" << sss.str() << "\n";

  auto compiler = xacc::getCompiler("staq");
  auto inst = compiler->compile(sss.str())->getComposites()[0];
  std::cout << inst->toString() << "\n";
  // std::cout << inst->toString() << "\n";

  // Map this CompositeInstruction to QRT calls
  auto visitor = std::make_shared<qcor::qrt_mapper>(inst->name());
+0 −3
Original line number Diff line number Diff line
@@ -18,9 +18,6 @@ H = FOp('', 0.0002899) + FOp('0^ 0', -.43658) + \
n_params = 1
obj = createObjectiveFunction(ansatz, H, n_params)

# evaluate at a concrete set of params
vqe_energy = obj([.59])

# Run full optimization
optimizer = createOptimizer('nlopt')
results = optimizer.optimize(obj)
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ class KernelArgDictToHeterogeneousMap {
// Add type name to this list to support receiving from Python.
using PyHeterogeneousMapTypes =
    xacc::Variant<bool, int, double, std::string,
                  std::shared_ptr<qcor::Optimizer>, std::vector<double>>;
                  std::shared_ptr<qcor::Optimizer>, std::vector<double>, std::vector<std::vector<double>>>;
using PyHeterogeneousMap = std::map<std::string, PyHeterogeneousMapTypes>;

// Helper to convert a Python *dict* (as a map of variants) into a native