Commit d691f54d authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Updated QAOA circuit runtime arguments



First argument is the qreg.
Signed-off-by: Nguyen, Thien Minh's avatarNguyen, Thien <nguyentm@ornl.gov>
parent d9ffbe37
......@@ -165,11 +165,11 @@ std::shared_ptr<CompositeInstruction> QAOA::constructParameterizedKernel() const
void QAOA::applyRuntimeArguments()
{
// Apply runtime arguments: i.e. resolve all parameters to concrete values
m_nbQubits = arguments[0]->runtimeValue.get<int>(INTERNAL_ARGUMENT_VALUE_KEY);
const std::vector<double> betaVec = arguments[1]->runtimeValue.get<std::vector<double>>(INTERNAL_ARGUMENT_VALUE_KEY);
const std::vector<double> gammaVec = arguments[2]->runtimeValue.get<std::vector<double>>(INTERNAL_ARGUMENT_VALUE_KEY);
auto costHam = arguments[3]->runtimeValue.getPointerLike<xacc::Observable>(INTERNAL_ARGUMENT_VALUE_KEY);
auto refHam = arguments[4]->runtimeValue.getPointerLike<xacc::Observable>(INTERNAL_ARGUMENT_VALUE_KEY);
m_nbQubits = arguments[1]->runtimeValue.get<int>(INTERNAL_ARGUMENT_VALUE_KEY);
const std::vector<double> betaVec = arguments[2]->runtimeValue.get<std::vector<double>>(INTERNAL_ARGUMENT_VALUE_KEY);
const std::vector<double> gammaVec = arguments[3]->runtimeValue.get<std::vector<double>>(INTERNAL_ARGUMENT_VALUE_KEY);
auto costHam = arguments[4]->runtimeValue.getPointerLike<xacc::Observable>(INTERNAL_ARGUMENT_VALUE_KEY);
auto refHam = arguments[5]->runtimeValue.getPointerLike<xacc::Observable>(INTERNAL_ARGUMENT_VALUE_KEY);
// Number of QAOA steps
m_nbSteps = betaVec.size()/m_nbQubits;
parseObservables(costHam, refHam);
......
......@@ -22,6 +22,7 @@ class QAOA : public xacc::quantum::Circuit {
public:
QAOA() : Circuit("qaoa") {
// Runtime arguments
arguments.push_back(std::make_shared<xacc::CompositeArgument>("qReg", "qreg"));
arguments.push_back(std::make_shared<xacc::CompositeArgument>("nbQubits", "int"));
arguments.push_back(std::make_shared<xacc::CompositeArgument>("gamma", "std::vector<double>"));
arguments.push_back(std::make_shared<xacc::CompositeArgument>("beta", "std::vector<double>"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment