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

Amplitude state array #45

Merged
merged 4 commits into from Jul 14, 2021
Merged

Amplitude state array #45

merged 4 commits into from Jul 14, 2021

Conversation

Mandrenkov
Copy link
Collaborator

@Mandrenkov Mandrenkov commented Jul 13, 2021

Context:
To support the remote execution of XIR programs using Jet, the interpreter used an integral representation of an amplitude state; however, since #28, this is no longer necessary and amplitude states should instead be specified as arrays.

Description of the Change:

  • The Jet interpreter for XIR scripts now requires the state parameter of amplitude statements to be an array.

Benefits:

  • The specification of an amplitude state is more natural.

Possible Drawbacks:
None.

Related GitHub Issues:
None.

@github-actions
Copy link

github-actions bot commented Jul 13, 2021

Test Report (C++) on Ubuntu

    1 files  ±0      1 suites  ±0   0s ⏱️ ±0s
521 tests ±0  521 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
870 runs  ±0  870 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 1fd21d0. ± Comparison against base commit 1fd21d0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jul 13, 2021

Test Report (Python) on Ubuntu

    1 files  ±0      1 suites  ±0   7s ⏱️ ±0s
505 tests ±0  505 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 1fd21d0. ± Comparison against base commit 1fd21d0.

♻️ This comment has been updated with latest results.

@Mandrenkov Mandrenkov requested a review from thisac July 13, 2021 20:07
@Mandrenkov Mandrenkov marked this pull request as ready for review July 13, 2021 20:07
Copy link

@thisac thisac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

Only one thing: I think it might be good to add a test for the "dimension" option as well, using a cutoff value larger than 2.

python/jet/interpreter.py Outdated Show resolved Hide resolved
@@ -118,7 +118,8 @@ def run_xir_program(program: XIRProgram) -> List[Union[np.number, np.ndarray]]:

num_wires = len(program.wires)
# TODO: Extract the Fock cutoff dimension from the XIR script.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO can now be removed, right? Or, perhaps even better, exchanged with a comment saying that a qubit circuit is assumed if no "dimension" is set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite. I experimented with using options in this PR but found that the implementation was not easy to get right. Specifically, we'll need to validate that each gate instance is compatible with the dimension of the circuit (which may involve a change to each Gate subclass). It would also be nice to allow implicit cutoff parameters too; however, this is also non-trivial without some kind of reflection hack.

That being said, I am currently working on a separate PR to address these points and remove the TODO 🙂.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: The PR is #47.

Copy link
Collaborator Author

@Mandrenkov Mandrenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

Thanks @thisac!

Only one thing: I think it might be good to add a test for the "dimension" option as well, using a cutoff value larger than 2.

As I mentioned in the review, I would prefer to do this in a future PR since it is a little tricky to implement correctly.

@@ -118,7 +118,8 @@ def run_xir_program(program: XIRProgram) -> List[Union[np.number, np.ndarray]]:

num_wires = len(program.wires)
# TODO: Extract the Fock cutoff dimension from the XIR script.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite. I experimented with using options in this PR but found that the implementation was not easy to get right. Specifically, we'll need to validate that each gate instance is compatible with the dimension of the circuit (which may involve a change to each Gate subclass). It would also be nice to allow implicit cutoff parameters too; however, this is also non-trivial without some kind of reflection hack.

That being said, I am currently working on a separate PR to address these points and remove the TODO 🙂.

python/jet/interpreter.py Outdated Show resolved Hide resolved
@Mandrenkov Mandrenkov merged commit 1fd21d0 into main Jul 14, 2021
@Mandrenkov Mandrenkov deleted the amplitude-state-array branch July 14, 2021 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants