Is your feature request related to a problem? Please describe.
With pyqir 0.12 I now need to find an alternative to is_qubit_type and is_result_type because I need to know which pointer type it is.
Describe the solution you had in mind
ChatGPT recommends that I do something like this:
class PtrRole(Enum):
QUBIT = "qubit"
RESULT = "result"
QIS_PTR_ROLES: dict[str, dict[int, PtrRole]] = {
"__quantum__qis__h__body": {0: PtrRole.QUBIT},
"__quantum__qis__x__body": {0: PtrRole.QUBIT},
"__quantum__qis__y__body": {0: PtrRole.QUBIT},
"__quantum__qis__z__body": {0: PtrRole.QUBIT},
"__quantum__qis__s__body": {0: PtrRole.QUBIT},
"__quantum__qis__s__adj": {0: PtrRole.QUBIT},
"__quantum__qis__t__body": {0: PtrRole.QUBIT},
"__quantum__qis__t__adj": {0: PtrRole.QUBIT},
"__quantum__qis__reset__body": {0: PtrRole.QUBIT},
"__quantum__qis__cnot__body": {0: PtrRole.QUBIT, 1: PtrRole.QUBIT},
"__quantum__qis__cz__body": {0: PtrRole.QUBIT, 1: PtrRole.QUBIT},
"__quantum__qis__swap__body": {0: PtrRole.QUBIT, 1: PtrRole.QUBIT},
"__quantum__qis__ccx__body": {
0: PtrRole.QUBIT,
1: PtrRole.QUBIT,
2: PtrRole.QUBIT,
},
"__quantum__qis__rx__body": {1: PtrRole.QUBIT},
"__quantum__qis__ry__body": {1: PtrRole.QUBIT},
"__quantum__qis__rz__body": {1: PtrRole.QUBIT},
# This is the important mixed case.
"__quantum__qis__mz__body": {
0: PtrRole.QUBIT,
1: PtrRole.RESULT,
},
# Include this if your input QIR uses it.
"__quantum__qis__read_result__body": {
0: PtrRole.RESULT,
},
}
which I could do easily enough.
My question though is whether this sort of logic belongs in pyqir instead of in my code.
Is your feature request related to a problem? Please describe.
With pyqir 0.12 I now need to find an alternative to
is_qubit_typeandis_result_typebecause I need to know which pointer type it is.Describe the solution you had in mind
ChatGPT recommends that I do something like this:
which I could do easily enough.
My question though is whether this sort of logic belongs in
pyqirinstead of in my code.