qiskit-braket-provider
qiskit-braket-provider copied to clipboard
ParameterExpression with operations other then add, mul, neg are not translatable.
Steps to reproduce the problem
Translating circuits like:
qiskit_circuit = QuantumCircuit(1)
v = ParameterVector("v", 2)
qiskit_circuit.rx(Parameter("a")/Parameter("b"), 0)
braket_circuit = to_braket(qiskit_circuit)
will throw an error because we serialize and parse the ast to create a FreeParameterExpression instead of relying on Sympy.
What is the current behavior?
Throws an error.
ValueError: Unsupported binary operation: <class 'ast.Div'>
What is the expected behavior?
Create a correct FreeParameterExpression.
Thank you for this issue! We will look into this.
Dumping some thoughts here:
- Sympy could do heavy-lifting via
Parameter.sympify()
and then create the Braket FreeParameterExpression. - we are parsing ParameterExpression string to rename ParameterVectorElement, which conflicts with the first point.
- Someone could always use
Parameter("a")*Parameter("b")
and assign inverted values to b.
Division will be solved with https://github.com/amazon-braket/amazon-braket-sdk-python/pull/885