qiskit-community / qiskit-braket-provider

Qiskit-Braket provider to execute Qiskit programs on quantum computing hardware devices through Amazon Braket.
https://qiskit-community.github.io/qiskit-braket-provider/
Apache License 2.0
58 stars 45 forks source link

ParameterExpression with operations other then add, mul, neg are not translatable. #153

Open jcjaskula-aws opened 7 months ago

jcjaskula-aws commented 7 months ago

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.

ashlhans commented 7 months ago

Thank you for this issue! We will look into this.

jcjaskula-aws commented 7 months ago

Dumping some thoughts here:

speller26 commented 7 months ago

Division will be solved with https://github.com/amazon-braket/amazon-braket-sdk-python/pull/885