-
Notifications
You must be signed in to change notification settings - Fork 9
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 integer division with //
operator
#9
Comments
Hi, I am complete begineer in Quantum computing but I do have programming experience. Could you guide me through this? I would love to take up this issue. |
@daredevil3435 - thanks for your interest! This issue actually requires very little awareness of quantum computing, so it may be a good place to start for you. This issue will require translating the Python A good place to start is to look at how we currently do this for comparison operators First, there is a converter defined here in the Then, the operator functions ( Finally, you will need to call your new converter from the transpiler here, to ensure that it gets invoked when transpiling the AutoQASM program: autoqasm/src/autoqasm/transpiler/transpiler.py Lines 121 to 139 in aebde14
Feel free to give that a try, and let me know if you have any specific questions! |
so basically I need to
|
@daredevil3435 yes, I think that's basically it! The third step is just adding one line of code - a call to the |
I have added new function, converter in it. Started doing unit tests but it gave me an error. Should I open a PR for you to review my changes if they're correct or not? |
Hello @daredevil3435 and @rmshaffer, I just opened a PR ( #29 ) to address this issue, building on the work @daredevil3435 had already done but changing a few key things. There is not much time left for UnitaryHack so maybe we can work together to close the issue 🤝 and split the bounty 💰? Otherwise, I am happy to step aside since the issue had been claimed already. I was also wondering what the behavior should be when the user uses integer division between a FloatVar and an IntVar. For example, |
Thanks for taking a look at this @abidart! That's a great question - I think having integer division result in an |
Hi. I actually did a lot of hard work on this issue as basically it is my first ever bug bounty. I have already done major part of the work. So if you want to carry it forward let's split the bounty. |
@daredevil3435 sounds great, thank you very much! I will try my best to wrap it up ASAP (hopefully we will make it on time). Also, feel free to DM me on the server (my username is abid). Let me know if you have any questions or suggestions for the PR. I've been working on the codebase too for the last couple of days—also learning a lot—and we can definitely chat about it! |
@daredevil3435 @abidart thank you both! I have no doubt we'll get this wrapped up in time. I'll try to keep reviewing your changes promptly. |
Given that the Python docs state:
I am leaning towards returning a I made the corresponding changes to the PR, but I am happy to backtrack if you @rmshaffer think it would be best to do otherwise. |
Assigning @abidart and @daredevil3435 to split the unitaryHACK bounty for this issue. Thanks again to both of you for your contribution to solve this issue! |
Users should be able to perform integer division on variables in the program. For example:
In fixing this we must ensure that integer division operations are generated according to the OpenQASM spec.
For example, see:
IntegerLiteral
s amazon-braket-default-simulator-python#247pow
modifiers openqasm/openqasm#529And any Python floating-point division operations should also be converted into appropriate floating-point operations in the OpenQASM.
The text was updated successfully, but these errors were encountered: