Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jcjaskula-aws opened this issue Feb 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@jcjaskula-aws
Copy link
Collaborator

jcjaskula-aws commented Feb 12, 2024

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.

@jcjaskula-aws jcjaskula-aws added the bug Something isn't working label Feb 12, 2024
@ashlhans
Copy link
Collaborator

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

@jcjaskula-aws
Copy link
Collaborator Author

jcjaskula-aws commented Feb 16, 2024

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.

@speller26
Copy link
Collaborator

Division will be solved with amazon-braket/amazon-braket-sdk-python#885

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants