Skip to content
GitLab
Menu
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
0999695f
Commit
0999695f
authored
Jul 16, 2020
by
Nguyen, Thien Minh
Browse files
Added a kitchen-sink test
Signed-off-by:
Thien Nguyen
<
nguyentm@ornl.gov
>
parent
685377e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
quantum/plugins/optimizers/gate_merge/tests/GateMergingTester.cpp
View file @
0999695f
...
...
@@ -43,6 +43,31 @@ TEST(GateMergingTester, checkSingleQubitStopAtTwoQubitGate)
EXPECT_EQ
(
f
->
getInstruction
(
2
)
->
name
(),
"H"
);
}
TEST
(
GateMergingTester
,
checkMixing
)
{
auto
c
=
xacc
::
getService
<
xacc
::
Compiler
>
(
"xasm"
);
auto
f
=
c
->
compile
(
R"(__qpu__ void test2(qbit q) {
H(q[1]);
CNOT(q[1], q[0]);
H(q[0]);
H(q[1]);
X(q[0]);
// Not involved
CNOT(q[2], q[3]);
X(q[1]);
H(q[0]);
H(q[1]);
CNOT(q[0], q[2]);
Z(q[1]);
})"
)
->
getComposites
()[
0
];
auto
opt
=
xacc
::
getService
<
xacc
::
IRTransformation
>
(
"single-qubit-gate-merging"
);
opt
->
apply
(
f
,
nullptr
);
std
::
cout
<<
"HOWDY:
\n
"
<<
f
->
toString
()
<<
"
\n
"
;
EXPECT_EQ
(
f
->
nInstructions
(),
5
);
}
int
main
(
int
argc
,
char
**
argv
)
{
xacc
::
Initialize
(
argc
,
argv
);
::
testing
::
InitGoogleTest
(
&
argc
,
argv
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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