{"action":"created","issue":{"url":"https://api.github.com/repos/quantumlib/Cirq/issues/1169","repository_url":"https://api.github.com/repos/quantumlib/Cirq","labels_url":"https://api.github.com/repos/quantumlib/Cirq/issues/1169/labels{/name}","comments_url":"https://api.github.com/repos/quantumlib/Cirq/issues/1169/comments","events_url":"https://api.github.com/repos/quantumlib/Cirq/issues/1169/events","html_url":"https://github.com/quantumlib/Cirq/pull/1169","id":381768092,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxNjYxNDk3","number":1169,"title":"2-qubit matrix decomposition into ion trap gates","user":{"login":"mlihc15","id":17053067,"node_id":"MDQ6VXNlcjE3MDUzMDY3","avatar_url":"https://avatars1.githubusercontent.com/u/17053067?v=4","gravatar_id":"","url":"https://api.github.com/users/mlihc15","html_url":"https://github.com/mlihc15","followers_url":"https://api.github.com/users/mlihc15/followers","following_url":"https://api.github.com/users/mlihc15/following{/other_user}","gists_url":"https://api.github.com/users/mlihc15/gists{/gist_id}","starred_url":"https://api.github.com/users/mlihc15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlihc15/subscriptions","organizations_url":"https://api.github.com/users/mlihc15/orgs","repos_url":"https://api.github.com/users/mlihc15/repos","events_url":"https://api.github.com/users/mlihc15/events{/privacy}","received_events_url":"https://api.github.com/users/mlihc15/received_events","type":"User","site_admin":false},"labels":[{"id":922112536,"node_id":"MDU6TGFiZWw5MjIxMTI1MzY=","url":"https://api.github.com/repos/quantumlib/Cirq/labels/cla:%20yes","name":"cla: yes","color":"FFFFFF","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-16T21:33:33Z","updated_at":"2018-12-05T23:30:33Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/quantumlib/Cirq/pulls/1169","html_url":"https://github.com/quantumlib/Cirq/pull/1169","diff_url":"https://github.com/quantumlib/Cirq/pull/1169.diff","patch_url":"https://github.com/quantumlib/Cirq/pull/1169.patch"},"body":"Adding ion_decomposition.py and ion_decomposition_test.py. \r\ncirq.two_qubit_matrix_to_ion_operations converts two-qubit matrix to ion trap gates. This method is essentially using KAK decomposition and translates all non local interactions into cirq.MS gate, which is the native 2-qubit gate in ion traps."},"comment":{"url":"https://api.github.com/repos/quantumlib/Cirq/issues/comments/444691499","html_url":"https://github.com/quantumlib/Cirq/pull/1169#issuecomment-444691499","issue_url":"https://api.github.com/repos/quantumlib/Cirq/issues/1169","id":444691499,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDY5MTQ5OQ==","user":{"login":"Strilanc","id":79941,"node_id":"MDQ6VXNlcjc5OTQx","avatar_url":"https://avatars1.githubusercontent.com/u/79941?v=4","gravatar_id":"","url":"https://api.github.com/users/Strilanc","html_url":"https://github.com/Strilanc","followers_url":"https://api.github.com/users/Strilanc/followers","following_url":"https://api.github.com/users/Strilanc/following{/other_user}","gists_url":"https://api.github.com/users/Strilanc/gists{/gist_id}","starred_url":"https://api.github.com/users/Strilanc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Strilanc/subscriptions","organizations_url":"https://api.github.com/users/Strilanc/orgs","repos_url":"https://api.github.com/users/Strilanc/repos","events_url":"https://api.github.com/users/Strilanc/events{/privacy}","received_events_url":"https://api.github.com/users/Strilanc/received_events","type":"User","site_admin":false},"created_at":"2018-12-05T23:30:33Z","updated_at":"2018-12-05T23:30:33Z","author_association":"CONTRIBUTOR","body":"Hmmmmm, I see.\r\n\r\n```\r\nIn [8]: cirq.Circuit.from_ops(cirq.ion.two_qubit_matrix_to_ion_operations(a, b, cirq.unitary(cirq.MS(np.pi*0.25))))                                                                                                \r\nOut[8]: \r\n0: ───Z───MS(-0.25π)───Y───\r\n          │\r\n1: ───Z───MS(-0.25π)───Y───\r\n```\r\n\r\nWe can add a pass akin to the phased Pauli ejection optimization to fix this. Basically we have the following rule: a Z before the MS gate can be passed over the MS(pi/4) or MS(-pi/4) gate by turning the Z into a Y and adding an X on the other wire. An equivalent rule exists for Y: passing over transforms the Y into a Z and kicks out an X on the other line.\r\n\r\nThis works because the MS gate at those angles has the following form:\r\n\r\n![image](https://user-images.githubusercontent.com/79941/49550999-5ccb0700-f8a2-11e8-99c2-50084826d884.png)\r\n\r\nPassing the Z over the sqrt(X) is what turns the Z into a Y, and passing it over the XNOT is what kicks out the other X. Technically you should transform into -Y instead of Y in some cases, but that's only if you care about global phase.\r\n\r\nI would copy paste the `EjectPhasedPaulis` class and cut down the rules to just that Y and Z thing."}}
{"actor":{"display_login":"Strilanc"}}