Qiskit / qiskit-ibm-runtime

IBM Client for Qiskit Runtime
https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
Apache License 2.0
161 stars 157 forks source link

Consider handling rzz validation for parametrized angles #2000

Open yaelbh opened 1 month ago

yaelbh commented 1 month ago

rzz angle is allowed only in the range [0, pi/2]. If a user writes rzz(-1, qubit) or rzz(3, qubit) (i.e., the angle is a number) then our ISA validation will correctly fail. But, if the user writes rzz(param, qubit), where param is a qiskit.circuit.Parameter, and assigns a negative (or greater than pi/2) value to the parameter - this will not be caught by the validation process, and therefore will fail much later in the stack.

yaelbh commented 1 month ago

See Slack thread: https://ibm-quantumcomputing.slack.com/archives/C06NWM5FUKC/p1730189009542039

yaelbh commented 3 weeks ago

I want to change the signature of is_isa_circuit, such that it receives a pub instead of a circuit, but I don't know if it's considered to be an API break that requires deprecation.

@jyu00 @kevinsung @mberna Does it require deprecation?

To be on the safe side, for now I'll leave ISA validation unchanged. I'll add two new functions, validate_rzz_pub and is_rzz_pub.

kevinsung commented 3 weeks ago

I don't really work on this repository, perhaps you mean to ping @kt474 .

jyu00 commented 3 weeks ago

I want to change the signature of is_isa_circuit, such that it receives a pub instead of a circuit, but I don't know if it's considered to be an API break that requires deprecation.

@jyu00 @kevinsung @mberna Does it require deprecation?

To be on the safe side, for now I'll leave ISA validation unchanged. I'll add two new functions, validate_rzz_pub and is_rzz_pub.

It's not an API break since is_isa_circuit is technically a private method (i.e. it's not documented in API reference).

yaelbh commented 2 weeks ago

Following #2035, we should also take into account parameter expressions.