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
3235881e
Commit
3235881e
authored
Sep 10, 2021
by
Nguyen, Thien Minh
Browse files
Adding layer id to gate node
Signed-off-by:
Thien Nguyen
<
nguyentm@ornl.gov
>
parent
9c7d2f14
Changes
1
Hide whitespace changes
Inline
Side-by-side
quantum/gate/utils/IRToGraphVisitor.cpp
View file @
3235881e
...
...
@@ -30,7 +30,10 @@ void IRToGraphVisitor::addSingleQubitGate(Gate &inst) {
std
::
make_pair
(
"bits"
,
inst
.
bits
())};
graph
->
addVertex
(
newNode
);
graph
->
addEdge
(
lastNode
.
get
<
std
::
size_t
>
(
"id"
),
newNode
.
get
<
std
::
size_t
>
(
"id"
),
1
);
graph
->
addEdge
(
lastNode
.
get
<
std
::
size_t
>
(
"id"
),
newNode
.
get
<
std
::
size_t
>
(
"id"
),
1
);
const
int
layerId
=
graph
->
depth
();
graph
->
getVertexProperties
(
id
).
insert
(
"layer"
,
layerId
);
qubitToLastNode
[
bit
]
=
newNode
;
}
...
...
@@ -49,7 +52,8 @@ void IRToGraphVisitor::addTwoQubitGate(Gate &inst) {
graph
->
addVertex
(
newNode
);
graph
->
addEdge
(
lastsrcnodeid
,
id
,
1
);
graph
->
addEdge
(
lasttgtnodeid
,
id
,
1
);
const
auto
layerId
=
graph
->
depth
();
graph
->
getVertexProperties
(
id
).
insert
(
"layer"
,
layerId
);
qubitToLastNode
[
srcbit
]
=
newNode
;
qubitToLastNode
[
tgtbit
]
=
newNode
;
}
...
...
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