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

Support for symbolic expressions in FreeParameters #82

Closed
kshyatt-aws opened this issue May 9, 2024 · 7 comments · Fixed by #85
Closed

Support for symbolic expressions in FreeParameters #82

kshyatt-aws opened this issue May 9, 2024 · 7 comments · Fixed by #85
Assignees
Labels
good first issue Good for newcomers

Comments

@kshyatt-aws
Copy link
Member

kshyatt-aws commented May 9, 2024

Describe the feature you'd like
Currently only numerical values are allowed for FreeParameter. We should replicate the Python SDK support for FreeParameterExpression, allowing gates like Rx( 2 * alpha /3), for example.

Is this feature already present in the Python SDK?
Yes. https://github.com/amazon-braket/amazon-braket-sdk-python/blob/main/src/braket/parametric/free_parameter_expression.py

How would this feature be used? Please describe.
This would allow more complex expressions for parametrized gates.

Describe alternatives you've considered
Currently users have to create new parameters to capture cases like 2 * alpha.

Additional context
An appropriate Julia package should be chosen for the symbolic expressions. SymbolicExpressions.jl is one example.

@kshyatt-aws kshyatt-aws added the good first issue Good for newcomers label May 14, 2024
@Fe-r-oz
Copy link

Fe-r-oz commented Jun 3, 2024

Hi @kshyatt-aws , Sounds Interesting! I would like to work on this issue.

Should I include theFreeParameterExpression details after FreeExpression ?

struct FreeParameter

@kshyatt-aws
Copy link
Member Author

Yes, I think that would make sense, because FreeParameterExpression might contain one or multiple FreeParameters (e.g. Rx(alpha + 2*beta)).

@Fe-r-oz
Copy link

Fe-r-oz commented Jun 4, 2024

Hi, @kshyatt-aws,

Please let me know that the output looks something like this:

I have used α + 2θ as FreeParameterExpression

julia> new_circ = circ(theta=2.0, alpha=1.0)
T  : |    0     |   1   |   2   |Result Types|
                                              
q0 : -H----------Ry(2.0)-Ry(2.0)-Probability--
                                 |            
q1 : -Rx(α + 2θ)-----------------Probability--
                                              
T  : |    0     |   1   |   2   |Result Types|

I was spending time with reading the guidelines. Shall I open a PR now?

@kshyatt-aws
Copy link
Member Author

Yes, something like this would be great. You might want to consider using showcompact if the expression is really long/complex.

@Fe-r-oz
Copy link

Fe-r-oz commented Jun 12, 2024

Hi, @kshyatt-aws, Please assign the issue to me after closing it! 😬 All suggestions have been incorporated 🙏🏼 !

@Fe-r-oz
Copy link

Fe-r-oz commented Jun 17, 2024

Hi, Please assign the closed issue. Thanks.

@Fe-r-oz
Copy link

Fe-r-oz commented Jun 17, 2024

The closed by:"hacker name" that appears under closed Bounties is empty because the issue is unassigned. Please fix the issue, @kshyatt-aws, Thanks!

Please see that theclosed_byis not appearing which means that issue is not assigned to me.

Screenshot from 2024-06-17 23-21-46

kshyatt-aws added a commit that referenced this issue Aug 28, 2024
* Feature: Adding support for FreeParameterExpression, resolving Issue #82

* [Feature]: Adding support for FreeParameterExpression: Improving tests and subs function

* [Feature]: Adding support for FreeParameterExpression - minor cleanup

* [Feature]: Adding support for FreeParameterExpression - Formatting

* [Feature]: Adding support for FreeParameterExpression - Adding codereview suggestions

* [Feature]: Adding support for FreeParameterExpression - completing codereview suggestions

* [Feature]: Adding support for FreeParameterExpression - direct gate generation example to doctests

* [Feature]: Adding support for FreeParameterExpression - formatting

* [Feature]: Adding support for FreeParameterExpression - formatting

* [Feature]: Adding support for FreeParameterExpression - Adding more tests

* [Feature]: Adding support for FreeParameterExpression - formatting

* sliming down the operator functions

* codereview suggestions

* Minor Formatting, Including complete Greek Letters

* fix Symbolic version to 5.30.0 and SymbolicUtils to 2.0.2

* using SymbolicUtils  = =2.0.2

---------

Signed-off-by: Katharine Hyatt <[email protected]>
Co-authored-by: Fe-r-oz <[email protected]>
Co-authored-by: Katharine Hyatt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants