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
2603bc3b
Commit
2603bc3b
authored
Feb 13, 2019
by
Zachary Parks
Browse files
Changing CircuitOptimizer to handle variable InstructionParameters
Signed-off-by:
Zachary Parks
<
1zp@ornl.gov
>
parent
2f9128d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
quantum/gate/compiler/CircuitOptimizer.cpp
View file @
2603bc3b
...
...
@@ -49,14 +49,14 @@ std::shared_ptr<IR> CircuitOptimizer::transform(std::shared_ptr<IR> ir) {
auto
inst
=
gateFunction
->
getInstruction
(
i
);
if
(
isRotation
(
inst
->
name
()))
{
auto
param
=
inst
->
getParameter
(
0
);
double
val
=
ipToDouble
(
param
);
if
(
std
::
fabs
(
val
)
<
1e-12
)
{
inst
->
disable
();
if
(
!
param
.
isVariable
())
{
double
val
=
ipToDouble
(
param
);
if
(
std
::
fabs
(
val
)
<
1e-12
)
{
inst
->
disable
();
}
}
}
}
// Remove all CNOT(p,q) CNOT(p,q) Pairs
while
(
true
)
{
bool
modified
=
false
;
...
...
@@ -78,7 +78,6 @@ std::shared_ptr<IR> CircuitOptimizer::transform(std::shared_ptr<IR> ir) {
}
}
}
if
(
!
modified
)
break
;
}
...
...
@@ -94,7 +93,6 @@ std::shared_ptr<IR> CircuitOptimizer::transform(std::shared_ptr<IR> ir) {
auto
adj
=
graphView
.
getNeighborList
(
node
.
id
());
std
::
vector
<
int
>
nAsVec
(
adj
.
begin
(),
adj
.
end
());
if
(
adj
.
size
()
==
1
)
{
auto
nextNode
=
graphView
.
getVertex
(
nAsVec
[
0
]);
if
(
node
.
name
()
==
"H"
&&
nextNode
.
name
()
==
"H"
)
{
...
...
@@ -125,7 +123,6 @@ std::shared_ptr<IR> CircuitOptimizer::transform(std::shared_ptr<IR> ir) {
}
}
}
return
ir
;
}
...
...
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