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
3885817f
Commit
3885817f
authored
Aug 07, 2017
by
Mccaskey, Alex
Browse files
minor cleanup
parent
c9028e3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
quantum/gate/ir/GateQIR.cpp
View file @
3885817f
...
...
@@ -236,30 +236,34 @@ bool GateQIR::incrementLayer(const std::vector<std::string>& gateCommand,
std
::
string
GateQIR
::
toAssemblyString
(
const
std
::
string
&
kernelName
,
const
std
::
string
&
accBufferVarName
)
{
std
::
string
retStr
=
""
;
auto
kernel
=
getKernel
(
kernelName
);
std
::
set
<
int
>
qubitsUsed
;
InstructionIterator
it
(
kernel
);
while
(
it
.
hasNext
())
{
// Get the next node in the tree
auto
nextInst
=
it
.
next
();
// If enabled, invoke the accept
// method which kicks off the visitor
// to execute the appropriate lambda.
if
(
nextInst
->
isEnabled
()
&&
!
nextInst
->
isComposite
())
{
for
(
auto
qi
:
nextInst
->
bits
())
{
qubitsUsed
.
insert
(
qi
);
if
(
!
kernelName
.
empty
())
{
auto
kernel
=
getKernel
(
kernelName
);
return
kernel
->
toString
(
accBufferVarName
);
std
::
set
<
int
>
qubitsUsed
;
InstructionIterator
it
(
kernel
);
while
(
it
.
hasNext
())
{
// Get the next node in the tree
auto
nextInst
=
it
.
next
();
// If enabled, invoke the accept
// method which kicks off the visitor
// to execute the appropriate lambda.
if
(
nextInst
->
isEnabled
()
&&
!
nextInst
->
isComposite
())
{
for
(
auto
qi
:
nextInst
->
bits
())
{
qubitsUsed
.
insert
(
qi
);
}
}
}
}
for
(
auto
qi
:
qubitsUsed
)
{
retStr
+=
"qubit "
+
accBufferVarName
+
std
::
to_string
(
qi
)
+
"
\n
"
;
}
for
(
auto
f
:
kernels
)
{
retStr
+=
f
->
toString
(
accBufferVarName
);
for
(
auto
qi
:
qubitsUsed
)
{
retStr
+=
"qubit "
+
accBufferVarName
+
std
::
to_string
(
qi
)
+
"
\n
"
;
}
}
else
{
for
(
auto
f
:
kernels
)
{
retStr
+=
f
->
toString
(
accBufferVarName
);
}
}
return
retStr
;
}
...
...
@@ -269,13 +273,6 @@ void GateQIR::persist(std::ostream& outStream) {
JsonVisitor
visitor
(
kernels
);
outStream
<<
visitor
.
write
();
// StringBuffer sb;
// PrettyWriter<StringBuffer> writer(sb);
//
// serializeJson(writer);
//
// outStream << sb.GetString();
return
;
}
...
...
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