{"action":"created","comment":{"url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments/168469514","pull_request_review_id":96839449,"id":168469514,"diff_hunk":"@@ -0,0 +1,187 @@\n+#   Licensed under the Apache License, Version 2.0 (the \"License\");\n+#   you may not use this file except in compliance with the License.\n+#   You may obtain a copy of the License at\n+#\n+#       http://www.apache.org/licenses/LICENSE-2.0\n+#\n+#   Unless required by applicable law or agreed to in writing, software\n+#   distributed under the License is distributed on an \"AS IS\" BASIS,\n+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+#   See the License for the specific language governing permissions and\n+#   limitations under the License.\n+\n+\"\"\" The transform function that does Fermion-qubit mappings\n+    based on a BinaryCode (arXiv:1712.07067) \"\"\"\n+\n+import numpy\n+\n+from openfermion.ops import (BinaryCode,\n+                             FermionOperator,\n+                             QubitOperator,\n+                             SymbolicBinary)\n+\n+\n+def _extract(term):\n+    \"\"\"Extractor superoperator helper function.\n+\n+    Args:\n+        term (tuple): a single summand from a binary expression\n+\n+    Returns (QubitOperator or int): the qubit operator that corresponds\n+        to the binary expression or -1\n+    \"\"\"\n+    if len(term) == 1:\n+        term = term[0]\n+        if term[1] == 'W':\n+            return QubitOperator('Z' + str(term[0]))\n+        elif term[1] == '1':\n+            return -1\n+    if len(term) > 1:\n+        return dissolve(term)\n+\n+\n+def extractor(binary_op):\n+    \"\"\" Applies the extraction superoperator to a binary expression\n+     to obtain the corresponding qubit operators.\n+\n+    Args:\n+        binary_op (SymbolicBinary): the binary term\n+\n+    Returns (QubitOperator): the qubit operator corresponding to the\n+        binary terms\n+    \"\"\"\n+    return_fn = 1\n+    for term in binary_op.terms:\n+        return_fn *= _extract(term)\n+    return return_fn\n+\n+\n+def dissolve(term):\n+    \"\"\"Decomposition helper. Takes a product of binary variables\n+    and outputs the Pauli-string sum that corresponds to the\n+    decomposed multi-qubit operator.\n+\n+    Args:\n+        term (tuple): product of binary variables, i.e.: 'w0 w2 w3'\n+\n+    Returns (QubitOperator): superposition of Pauli-strings\n+\n+    Raises:\n+        ValueError: if the action is not 'W'","path":"src/openfermion/transforms/_binary_code_transform.py","position":70,"original_position":70,"commit_id":"cde904ee5b0b9c062e5b9cce4da2136d313c5119","original_commit_id":"6de657529a2d6934a4b2a7607e995ec8f8fad057","user":{"login":"msteudtner","id":35808920,"avatar_url":"https://avatars3.githubusercontent.com/u/35808920?v=4","gravatar_id":"","url":"https://api.github.com/users/msteudtner","html_url":"https://github.com/msteudtner","followers_url":"https://api.github.com/users/msteudtner/followers","following_url":"https://api.github.com/users/msteudtner/following{/other_user}","gists_url":"https://api.github.com/users/msteudtner/gists{/gist_id}","starred_url":"https://api.github.com/users/msteudtner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msteudtner/subscriptions","organizations_url":"https://api.github.com/users/msteudtner/orgs","repos_url":"https://api.github.com/users/msteudtner/repos","events_url":"https://api.github.com/users/msteudtner/events{/privacy}","received_events_url":"https://api.github.com/users/msteudtner/received_events","type":"User","site_admin":false},"body":"I'm not sure that is a very satisfying answer for you, but 'w' is just labeling the binary variables. It stems from the SymbolicBinary class.  At some point writing the paper I had to decide for symbols for the binary vectors of the Fermion modes and qubit configuration. I just called them \\nu and \\omega. We don't need  \\nu here, but \\omega  survived as 'w'. ","created_at":"2018-02-15T13:08:08Z","updated_at":"2018-02-15T13:08:08Z","html_url":"https://github.com/quantumlib/OpenFermion/pull/208#discussion_r168469514","pull_request_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/208","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments/168469514"},"html":{"href":"https://github.com/quantumlib/OpenFermion/pull/208#discussion_r168469514"},"pull_request":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/208"}},"in_reply_to_id":168452560},"pull_request":{"url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/208","id":169233302,"html_url":"https://github.com/quantumlib/OpenFermion/pull/208","diff_url":"https://github.com/quantumlib/OpenFermion/pull/208.diff","patch_url":"https://github.com/quantumlib/OpenFermion/pull/208.patch","issue_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/208","number":208,"state":"open","locked":false,"title":"transform function 3/4","user":{"login":"conta877","id":23045820,"avatar_url":"https://avatars2.githubusercontent.com/u/23045820?v=4","gravatar_id":"","url":"https://api.github.com/users/conta877","html_url":"https://github.com/conta877","followers_url":"https://api.github.com/users/conta877/followers","following_url":"https://api.github.com/users/conta877/following{/other_user}","gists_url":"https://api.github.com/users/conta877/gists{/gist_id}","starred_url":"https://api.github.com/users/conta877/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conta877/subscriptions","organizations_url":"https://api.github.com/users/conta877/orgs","repos_url":"https://api.github.com/users/conta877/repos","events_url":"https://api.github.com/users/conta877/events{/privacy}","received_events_url":"https://api.github.com/users/conta877/received_events","type":"User","site_admin":false},"body":"3rd pull request for #154","created_at":"2018-02-14T21:58:10Z","updated_at":"2018-02-15T13:08:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"54656c7fe1b4bc335fa52c9d78cc06aa108e5dc6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/208/commits","review_comments_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/208/comments","review_comment_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/208/comments","statuses_url":"https://api.github.com/repos/quantumlib/OpenFermion/statuses/cde904ee5b0b9c062e5b9cce4da2136d313c5119","head":{"label":"conta877:merger","ref":"merger","sha":"cde904ee5b0b9c062e5b9cce4da2136d313c5119","user":{"login":"conta877","id":23045820,"avatar_url":"https://avatars2.githubusercontent.com/u/23045820?v=4","gravatar_id":"","url":"https://api.github.com/users/conta877","html_url":"https://github.com/conta877","followers_url":"https://api.github.com/users/conta877/followers","following_url":"https://api.github.com/users/conta877/following{/other_user}","gists_url":"https://api.github.com/users/conta877/gists{/gist_id}","starred_url":"https://api.github.com/users/conta877/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conta877/subscriptions","organizations_url":"https://api.github.com/users/conta877/orgs","repos_url":"https://api.github.com/users/conta877/repos","events_url":"https://api.github.com/users/conta877/events{/privacy}","received_events_url":"https://api.github.com/users/conta877/received_events","type":"User","site_admin":false},"repo":{"id":116320457,"name":"OpenFermion","full_name":"conta877/OpenFermion","owner":{"login":"conta877","id":23045820,"avatar_url":"https://avatars2.githubusercontent.com/u/23045820?v=4","gravatar_id":"","url":"https://api.github.com/users/conta877","html_url":"https://github.com/conta877","followers_url":"https://api.github.com/users/conta877/followers","following_url":"https://api.github.com/users/conta877/following{/other_user}","gists_url":"https://api.github.com/users/conta877/gists{/gist_id}","starred_url":"https://api.github.com/users/conta877/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conta877/subscriptions","organizations_url":"https://api.github.com/users/conta877/orgs","repos_url":"https://api.github.com/users/conta877/repos","events_url":"https://api.github.com/users/conta877/events{/privacy}","received_events_url":"https://api.github.com/users/conta877/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/conta877/OpenFermion","description":"OpenFermion: The Electronic Structure Package For Quantum Computers.","fork":true,"url":"https://api.github.com/repos/conta877/OpenFermion","forks_url":"https://api.github.com/repos/conta877/OpenFermion/forks","keys_url":"https://api.github.com/repos/conta877/OpenFermion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/conta877/OpenFermion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/conta877/OpenFermion/teams","hooks_url":"https://api.github.com/repos/conta877/OpenFermion/hooks","issue_events_url":"https://api.github.com/repos/conta877/OpenFermion/issues/events{/number}","events_url":"https://api.github.com/repos/conta877/OpenFermion/events","assignees_url":"https://api.github.com/repos/conta877/OpenFermion/assignees{/user}","branches_url":"https://api.github.com/repos/conta877/OpenFermion/branches{/branch}","tags_url":"https://api.github.com/repos/conta877/OpenFermion/tags","blobs_url":"https://api.github.com/repos/conta877/OpenFermion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/conta877/OpenFermion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/conta877/OpenFermion/git/refs{/sha}","trees_url":"https://api.github.com/repos/conta877/OpenFermion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/conta877/OpenFermion/statuses/{sha}","languages_url":"https://api.github.com/repos/conta877/OpenFermion/languages","stargazers_url":"https://api.github.com/repos/conta877/OpenFermion/stargazers","contributors_url":"https://api.github.com/repos/conta877/OpenFermion/contributors","subscribers_url":"https://api.github.com/repos/conta877/OpenFermion/subscribers","subscription_url":"https://api.github.com/repos/conta877/OpenFermion/subscription","commits_url":"https://api.github.com/repos/conta877/OpenFermion/commits{/sha}","git_commits_url":"https://api.github.com/repos/conta877/OpenFermion/git/commits{/sha}","comments_url":"https://api.github.com/repos/conta877/OpenFermion/comments{/number}","issue_comment_url":"https://api.github.com/repos/conta877/OpenFermion/issues/comments{/number}","contents_url":"https://api.github.com/repos/conta877/OpenFermion/contents/{+path}","compare_url":"https://api.github.com/repos/conta877/OpenFermion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/conta877/OpenFermion/merges","archive_url":"https://api.github.com/repos/conta877/OpenFermion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/conta877/OpenFermion/downloads","issues_url":"https://api.github.com/repos/conta877/OpenFermion/issues{/number}","pulls_url":"https://api.github.com/repos/conta877/OpenFermion/pulls{/number}","milestones_url":"https://api.github.com/repos/conta877/OpenFermion/milestones{/number}","notifications_url":"https://api.github.com/repos/conta877/OpenFermion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/conta877/OpenFermion/labels{/name}","releases_url":"https://api.github.com/repos/conta877/OpenFermion/releases{/id}","deployments_url":"https://api.github.com/repos/conta877/OpenFermion/deployments","created_at":"2018-01-05T00:14:50Z","updated_at":"2018-01-25T19:41:34Z","pushed_at":"2018-02-15T11:51:17Z","git_url":"git://github.com/conta877/OpenFermion.git","ssh_url":"git@github.com:conta877/OpenFermion.git","clone_url":"https://github.com/conta877/OpenFermion.git","svn_url":"https://github.com/conta877/OpenFermion","homepage":"","size":2824,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"quantumlib:master","ref":"master","sha":"21bffcb32a0980959ed7db1d37f796c0eeab649e","user":{"login":"quantumlib","id":31279789,"avatar_url":"https://avatars1.githubusercontent.com/u/31279789?v=4","gravatar_id":"","url":"https://api.github.com/users/quantumlib","html_url":"https://github.com/quantumlib","followers_url":"https://api.github.com/users/quantumlib/followers","following_url":"https://api.github.com/users/quantumlib/following{/other_user}","gists_url":"https://api.github.com/users/quantumlib/gists{/gist_id}","starred_url":"https://api.github.com/users/quantumlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantumlib/subscriptions","organizations_url":"https://api.github.com/users/quantumlib/orgs","repos_url":"https://api.github.com/users/quantumlib/repos","events_url":"https://api.github.com/users/quantumlib/events{/privacy}","received_events_url":"https://api.github.com/users/quantumlib/received_events","type":"Organization","site_admin":false},"repo":{"id":104403768,"name":"OpenFermion","full_name":"quantumlib/OpenFermion","owner":{"login":"quantumlib","id":31279789,"avatar_url":"https://avatars1.githubusercontent.com/u/31279789?v=4","gravatar_id":"","url":"https://api.github.com/users/quantumlib","html_url":"https://github.com/quantumlib","followers_url":"https://api.github.com/users/quantumlib/followers","following_url":"https://api.github.com/users/quantumlib/following{/other_user}","gists_url":"https://api.github.com/users/quantumlib/gists{/gist_id}","starred_url":"https://api.github.com/users/quantumlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantumlib/subscriptions","organizations_url":"https://api.github.com/users/quantumlib/orgs","repos_url":"https://api.github.com/users/quantumlib/repos","events_url":"https://api.github.com/users/quantumlib/events{/privacy}","received_events_url":"https://api.github.com/users/quantumlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/quantumlib/OpenFermion","description":"OpenFermion: The Electronic Structure Package For Quantum Computers.","fork":false,"url":"https://api.github.com/repos/quantumlib/OpenFermion","forks_url":"https://api.github.com/repos/quantumlib/OpenFermion/forks","keys_url":"https://api.github.com/repos/quantumlib/OpenFermion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/quantumlib/OpenFermion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/quantumlib/OpenFermion/teams","hooks_url":"https://api.github.com/repos/quantumlib/OpenFermion/hooks","issue_events_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/events{/number}","events_url":"https://api.github.com/repos/quantumlib/OpenFermion/events","assignees_url":"https://api.github.com/repos/quantumlib/OpenFermion/assignees{/user}","branches_url":"https://api.github.com/repos/quantumlib/OpenFermion/branches{/branch}","tags_url":"https://api.github.com/repos/quantumlib/OpenFermion/tags","blobs_url":"https://api.github.com/repos/quantumlib/OpenFermion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/quantumlib/OpenFermion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/quantumlib/OpenFermion/git/refs{/sha}","trees_url":"https://api.github.com/repos/quantumlib/OpenFermion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/quantumlib/OpenFermion/statuses/{sha}","languages_url":"https://api.github.com/repos/quantumlib/OpenFermion/languages","stargazers_url":"https://api.github.com/repos/quantumlib/OpenFermion/stargazers","contributors_url":"https://api.github.com/repos/quantumlib/OpenFermion/contributors","subscribers_url":"https://api.github.com/repos/quantumlib/OpenFermion/subscribers","subscription_url":"https://api.github.com/repos/quantumlib/OpenFermion/subscription","commits_url":"https://api.github.com/repos/quantumlib/OpenFermion/commits{/sha}","git_commits_url":"https://api.github.com/repos/quantumlib/OpenFermion/git/commits{/sha}","comments_url":"https://api.github.com/repos/quantumlib/OpenFermion/comments{/number}","issue_comment_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/comments{/number}","contents_url":"https://api.github.com/repos/quantumlib/OpenFermion/contents/{+path}","compare_url":"https://api.github.com/repos/quantumlib/OpenFermion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/quantumlib/OpenFermion/merges","archive_url":"https://api.github.com/repos/quantumlib/OpenFermion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/quantumlib/OpenFermion/downloads","issues_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues{/number}","pulls_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls{/number}","milestones_url":"https://api.github.com/repos/quantumlib/OpenFermion/milestones{/number}","notifications_url":"https://api.github.com/repos/quantumlib/OpenFermion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/quantumlib/OpenFermion/labels{/name}","releases_url":"https://api.github.com/repos/quantumlib/OpenFermion/releases{/id}","deployments_url":"https://api.github.com/repos/quantumlib/OpenFermion/deployments","created_at":"2017-09-21T22:10:28Z","updated_at":"2018-02-15T05:11:31Z","pushed_at":"2018-02-15T11:51:18Z","git_url":"git://github.com/quantumlib/OpenFermion.git","ssh_url":"git@github.com:quantumlib/OpenFermion.git","clone_url":"https://github.com/quantumlib/OpenFermion.git","svn_url":"https://github.com/quantumlib/OpenFermion","homepage":"","size":2750,"stargazers_count":370,"watchers_count":370,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":87,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":87,"open_issues":13,"watchers":370,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/208"},"html":{"href":"https://github.com/quantumlib/OpenFermion/pull/208"},"issue":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/issues/208"},"comments":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/issues/208/comments"},"review_comments":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/208/comments"},"review_comment":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/208/commits"},"statuses":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/statuses/cde904ee5b0b9c062e5b9cce4da2136d313c5119"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"msteudtner"}}