You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should support switch statements in qcor kernels. We can definitely use if/else statements to express the same logic, but switch statements allow us to express equality-base conditional expressions more concisely.
enum Pauli {
X,
Y,
Z
};
__qpu__ voidtest(qreg a, Pauli p) {
switch (p) {
case Pauli::X: qcor::X(a); break;
case Pauli::Y: qcor::Y(a); break;
case Pauli::Z: qcor::Z(a); break;
}
}
intmain() {
qreg a = qalloc(2);
test(a, Pauli::X);
}
The text was updated successfully, but these errors were encountered:
We should support
switch
statements in qcor kernels. We can definitely useif/else
statements to express the same logic, butswitch
statements allow us to express equality-base conditional expressions more concisely.The text was updated successfully, but these errors were encountered: