Commit 3885817f authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

minor cleanup

parent c9028e3c
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment