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
bb2e322a
Unverified
Commit
bb2e322a
authored
Feb 13, 2019
by
Mccaskey, Alex
Committed by
GitHub
Feb 13, 2019
Browse files
Merge pull request #101 from zpparks314/master
Changing CircuitOptimizer to handle variable InstructionParameters
parents
2f9128d2
2603bc3b
Pipeline
#34847
passed with stages
in 10 minutes and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
quantum/gate/compiler/CircuitOptimizer.cpp
View file @
bb2e322a
...
...
@@ -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