Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ORNL Quantum Computing Institute
xacc
Commits
d691f54d
Commit
d691f54d
authored
May 27, 2020
by
Nguyen, Thien Minh
Browse files
Updated QAOA circuit runtime arguments
First argument is the qreg. Signed-off-by:
Nguyen, Thien
<
nguyentm@ornl.gov
>
parent
d9ffbe37
Changes
2
Hide whitespace changes
Inline
Side-by-side
quantum/plugins/algorithms/qaoa/qaoa_circuit.cpp
View file @
d691f54d
...
...
@@ -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
);
...
...
quantum/plugins/algorithms/qaoa/qaoa_circuit.hpp
View file @
d691f54d
...
...
@@ -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>"
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment