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
qcor
Commits
970f6c1f
Commit
970f6c1f
authored
Apr 17, 2019
by
Mccaskey, Alex
Browse files
adding deuteron H2 expgen example
Signed-off-by:
Alex McCaskey
<
mccaskeyaj@ornl.gov
>
parent
84189e17
Pipeline
#48830
passed with stages
in 2 minutes and 19 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
examples/deuteron_expgen.cpp
0 → 100644
View file @
970f6c1f
#include
"qcor.hpp"
int
main
(
int
argc
,
char
**
argv
)
{
qcor
::
Initialize
(
argc
,
argv
);
auto
optimizer
=
qcor
::
getOptimizer
(
"nlopt"
,
{{
"nlopt-optimizer"
,
"cobyla"
},
{
"nlopt-maxeval"
,
20
}});
auto
op
=
qcor
::
getObservable
(
"pauli"
,
"5.907 - 2.1433 X0X1 - 2.1433 Y0Y1 + .21829 Z0 - 6.125 Z1"
);
auto
future
=
qcor
::
submit
([
&
](
qcor
::
qpu_handler
&
qh
)
{
qh
.
vqe
(
[
&
](
double
x
)
{
X
(
0
);
exp_i_theta
(
x
,
{{
"pauli"
,
"X0 Y1 - Y0 X1"
}});
},
op
,
optimizer
);
});
auto
results
=
future
.
get
();
auto
energy
=
mpark
::
get
<
double
>
(
results
->
getInformation
(
"opt-val"
));
std
::
cout
<<
"Results: "
<<
energy
<<
"
\n
"
;
}
ir/digital/generators/exp/tests/ExpTester.cpp
View file @
970f6c1f
...
...
@@ -12,7 +12,11 @@ TEST(ExpTester, checkSimple) {
// NOW Test it somehow...
Exp
exp
;
auto
f
=
exp
.
generate
({{
"pauli"
,
"Y0 X1 X2 X3"
}});
exp
.
generate
({{
"pauli"
,
"Y0 X1 X2"
}});
std
::
cout
<<
"F:
\n
"
<<
f
->
toString
()
<<
"
\n
"
;
f
=
exp
.
generate
({{
"pauli"
,
"X0 Y1 - X1 Y0"
}});
std
::
cout
<<
"F:
\n
"
<<
f
->
toString
()
<<
"
\n
"
;
...
...
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