Skip to content

Commit e574dc9

Browse files
directly constructing control set instead of vector first
1 parent 987bcc1 commit e574dc9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/algorithms/StatePreparation.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ gatesToUncompute(std::vector<std::complex<double>>& amplitudes,
228228
}
229229
// as there were some systematic compiler errors with accessing the
230230
// qubit directly the controls are collected and then newly set
231-
std::vector<qc::Control> newControls;
231+
qc::Controls newControls;
232232
for (const auto& control : op->getControls()) {
233-
newControls.emplace_back(
233+
newControls.emplace(
234234
qc::Control{control.qubit + static_cast<Qubit>(i)});
235235
}
236-
op->setControls(qc::Controls{newControls.begin(), newControls.end()});
236+
op->setControls(newControls);
237237
}
238238
disentangler.emplace_back<Operation>(rzMultiplexer.asOperation());
239239
}
@@ -250,12 +250,12 @@ gatesToUncompute(std::vector<std::complex<double>>& amplitudes,
250250
}
251251
// as there were some systematic compiler errors with accessing the
252252
// qubit directly the controls are collected and then newly set
253-
std::vector<qc::Control> newControls;
253+
qc::Controls newControls;
254254
for (const auto& control : op->getControls()) {
255-
newControls.emplace_back(
255+
newControls.emplace(
256256
qc::Control{control.qubit + static_cast<Qubit>(i)});
257257
}
258-
op->setControls(qc::Controls{newControls.begin(), newControls.end()});
258+
op->setControls(newControls);
259259
}
260260
disentangler.emplace_back<Operation>(ryMultiplexer.asOperation());
261261
}

0 commit comments

Comments
 (0)