{"action":"created","comment":{"url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments/227691829","pull_request_review_id":167789478,"id":227691829,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzY5MTgyOQ==","diff_hunk":"@@ -0,0 +1,805 @@\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+\"\"\"\n+Classes for Bayesian estimators for quantum phase estimation.\n+Estimators described in arXiv:1809.09697 (in particular in App.C and App.C.1)\n+\"\"\"\n+import warnings\n+import numpy\n+from numpy import cos, sin, pi\n+from scipy import sparse, optimize\n+from openfermion.config import EQ_TOLERANCE\n+\n+\n+class FourierProbabilityDist(object):\n+    \"\"\"\n+    Stores a estimate of multiple phases in the form arXiv:1809.09697 App.C.\n+    In particular, stores the Fourier representation as a sum of sine and\n+    cosine waves (Eq. (C1)), and provides methods for manipulation of these.\n+    \"\"\"\n+\n+    def __init__(self,\n+                 amplitude_guess=None,\n+                 amplitude_vars=None,\n+                 num_vectors=1,\n+                 num_freqs=1000,\n+                 max_n=1,\n+                 vector_guess=None):\n+        \"\"\"\n+        Args:\n+            amplitude_guess (numpy array or list):\n+                estimates for amplitudes of different\n+                eigenstates in the initial state.\n+            amplitude_vars (numpy array or list): variance on the amplitude estimates\n+            num_vectors (int): number of phases to estimate\n+            num_freqs (int): number of frequencies in Fourier representation.\n+            max_n (int): maximum number of unitary evolutions before measurement.\n+                dictates how many matrices for updates are made and stored.\n+            vector_guess (numpy array): a prior estimate of the phases. If none,\n+                assumes flat.","path":"src/openfermion/measurements/_bayesian_estimators.py","position":49,"original_position":49,"commit_id":"f98d18e21cdd285942d34ccac19e4dd7a846f792","original_commit_id":"f98d18e21cdd285942d34ccac19e4dd7a846f792","user":{"login":"obriente","id":16646542,"node_id":"MDQ6VXNlcjE2NjQ2NTQy","avatar_url":"https://avatars1.githubusercontent.com/u/16646542?v=4","gravatar_id":"","url":"https://api.github.com/users/obriente","html_url":"https://github.com/obriente","followers_url":"https://api.github.com/users/obriente/followers","following_url":"https://api.github.com/users/obriente/following{/other_user}","gists_url":"https://api.github.com/users/obriente/gists{/gist_id}","starred_url":"https://api.github.com/users/obriente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obriente/subscriptions","organizations_url":"https://api.github.com/users/obriente/orgs","repos_url":"https://api.github.com/users/obriente/repos","events_url":"https://api.github.com/users/obriente/events{/privacy}","received_events_url":"https://api.github.com/users/obriente/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2018-10-24T08:38:39Z","updated_at":"2018-10-24T08:38:39Z","html_url":"https://github.com/quantumlib/OpenFermion/pull/468#discussion_r227691829","pull_request_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/468","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments/227691829"},"html":{"href":"https://github.com/quantumlib/OpenFermion/pull/468#discussion_r227691829"},"pull_request":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/468"}},"in_reply_to_id":227177151},"pull_request":{"url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/468","id":218449519,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NDQ5NTE5","html_url":"https://github.com/quantumlib/OpenFermion/pull/468","diff_url":"https://github.com/quantumlib/OpenFermion/pull/468.diff","patch_url":"https://github.com/quantumlib/OpenFermion/pull/468.patch","issue_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/468","number":468,"state":"open","locked":false,"title":"Bayesian estimator","user":{"login":"obriente","id":16646542,"node_id":"MDQ6VXNlcjE2NjQ2NTQy","avatar_url":"https://avatars1.githubusercontent.com/u/16646542?v=4","gravatar_id":"","url":"https://api.github.com/users/obriente","html_url":"https://github.com/obriente","followers_url":"https://api.github.com/users/obriente/followers","following_url":"https://api.github.com/users/obriente/following{/other_user}","gists_url":"https://api.github.com/users/obriente/gists{/gist_id}","starred_url":"https://api.github.com/users/obriente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obriente/subscriptions","organizations_url":"https://api.github.com/users/obriente/orgs","repos_url":"https://api.github.com/users/obriente/repos","events_url":"https://api.github.com/users/obriente/events{/privacy}","received_events_url":"https://api.github.com/users/obriente/received_events","type":"User","site_admin":false},"body":"Here's the Bayesian estimator split from #466.","created_at":"2018-09-26T20:46:32Z","updated_at":"2018-10-24T08:38:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9143808fd1bd558ba855464f496425436a883d14","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":923815919,"node_id":"MDU6TGFiZWw5MjM4MTU5MTk=","url":"https://api.github.com/repos/quantumlib/OpenFermion/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/468/commits","review_comments_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/468/comments","review_comment_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/468/comments","statuses_url":"https://api.github.com/repos/quantumlib/OpenFermion/statuses/f98d18e21cdd285942d34ccac19e4dd7a846f792","head":{"label":"obriente:bayesian_estimator","ref":"bayesian_estimator","sha":"f98d18e21cdd285942d34ccac19e4dd7a846f792","user":{"login":"obriente","id":16646542,"node_id":"MDQ6VXNlcjE2NjQ2NTQy","avatar_url":"https://avatars1.githubusercontent.com/u/16646542?v=4","gravatar_id":"","url":"https://api.github.com/users/obriente","html_url":"https://github.com/obriente","followers_url":"https://api.github.com/users/obriente/followers","following_url":"https://api.github.com/users/obriente/following{/other_user}","gists_url":"https://api.github.com/users/obriente/gists{/gist_id}","starred_url":"https://api.github.com/users/obriente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obriente/subscriptions","organizations_url":"https://api.github.com/users/obriente/orgs","repos_url":"https://api.github.com/users/obriente/repos","events_url":"https://api.github.com/users/obriente/events{/privacy}","received_events_url":"https://api.github.com/users/obriente/received_events","type":"User","site_admin":false},"repo":{"id":119523806,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk1MjM4MDY=","name":"OpenFermion","full_name":"obriente/OpenFermion","private":false,"owner":{"login":"obriente","id":16646542,"node_id":"MDQ6VXNlcjE2NjQ2NTQy","avatar_url":"https://avatars1.githubusercontent.com/u/16646542?v=4","gravatar_id":"","url":"https://api.github.com/users/obriente","html_url":"https://github.com/obriente","followers_url":"https://api.github.com/users/obriente/followers","following_url":"https://api.github.com/users/obriente/following{/other_user}","gists_url":"https://api.github.com/users/obriente/gists{/gist_id}","starred_url":"https://api.github.com/users/obriente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obriente/subscriptions","organizations_url":"https://api.github.com/users/obriente/orgs","repos_url":"https://api.github.com/users/obriente/repos","events_url":"https://api.github.com/users/obriente/events{/privacy}","received_events_url":"https://api.github.com/users/obriente/received_events","type":"User","site_admin":false},"html_url":"https://github.com/obriente/OpenFermion","description":"OpenFermion: The Electronic Structure Package For Quantum Computers.","fork":true,"url":"https://api.github.com/repos/obriente/OpenFermion","forks_url":"https://api.github.com/repos/obriente/OpenFermion/forks","keys_url":"https://api.github.com/repos/obriente/OpenFermion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/obriente/OpenFermion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/obriente/OpenFermion/teams","hooks_url":"https://api.github.com/repos/obriente/OpenFermion/hooks","issue_events_url":"https://api.github.com/repos/obriente/OpenFermion/issues/events{/number}","events_url":"https://api.github.com/repos/obriente/OpenFermion/events","assignees_url":"https://api.github.com/repos/obriente/OpenFermion/assignees{/user}","branches_url":"https://api.github.com/repos/obriente/OpenFermion/branches{/branch}","tags_url":"https://api.github.com/repos/obriente/OpenFermion/tags","blobs_url":"https://api.github.com/repos/obriente/OpenFermion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/obriente/OpenFermion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/obriente/OpenFermion/git/refs{/sha}","trees_url":"https://api.github.com/repos/obriente/OpenFermion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/obriente/OpenFermion/statuses/{sha}","languages_url":"https://api.github.com/repos/obriente/OpenFermion/languages","stargazers_url":"https://api.github.com/repos/obriente/OpenFermion/stargazers","contributors_url":"https://api.github.com/repos/obriente/OpenFermion/contributors","subscribers_url":"https://api.github.com/repos/obriente/OpenFermion/subscribers","subscription_url":"https://api.github.com/repos/obriente/OpenFermion/subscription","commits_url":"https://api.github.com/repos/obriente/OpenFermion/commits{/sha}","git_commits_url":"https://api.github.com/repos/obriente/OpenFermion/git/commits{/sha}","comments_url":"https://api.github.com/repos/obriente/OpenFermion/comments{/number}","issue_comment_url":"https://api.github.com/repos/obriente/OpenFermion/issues/comments{/number}","contents_url":"https://api.github.com/repos/obriente/OpenFermion/contents/{+path}","compare_url":"https://api.github.com/repos/obriente/OpenFermion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/obriente/OpenFermion/merges","archive_url":"https://api.github.com/repos/obriente/OpenFermion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/obriente/OpenFermion/downloads","issues_url":"https://api.github.com/repos/obriente/OpenFermion/issues{/number}","pulls_url":"https://api.github.com/repos/obriente/OpenFermion/pulls{/number}","milestones_url":"https://api.github.com/repos/obriente/OpenFermion/milestones{/number}","notifications_url":"https://api.github.com/repos/obriente/OpenFermion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/obriente/OpenFermion/labels{/name}","releases_url":"https://api.github.com/repos/obriente/OpenFermion/releases{/id}","deployments_url":"https://api.github.com/repos/obriente/OpenFermion/deployments","created_at":"2018-01-30T10:59:46Z","updated_at":"2018-09-30T18:11:09Z","pushed_at":"2018-10-19T08:40:45Z","git_url":"git://github.com/obriente/OpenFermion.git","ssh_url":"git@github.com:obriente/OpenFermion.git","clone_url":"https://github.com/obriente/OpenFermion.git","svn_url":"https://github.com/obriente/OpenFermion","homepage":"","size":3989,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"quantumlib:master","ref":"master","sha":"8a790335cc2ac7f82c53a22f821ce51e8486e79d","user":{"login":"quantumlib","id":31279789,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxMjc5Nzg5","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,"node_id":"MDEwOlJlcG9zaXRvcnkxMDQ0MDM3Njg=","name":"OpenFermion","full_name":"quantumlib/OpenFermion","private":false,"owner":{"login":"quantumlib","id":31279789,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxMjc5Nzg5","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},"html_url":"https://github.com/quantumlib/OpenFermion","description":"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-10-23T09:23:14Z","pushed_at":"2018-10-19T08:40:46Z","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":3686,"stargazers_count":649,"watchers_count":649,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":152,"mirror_url":null,"archived":false,"open_issues_count":53,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":152,"open_issues":53,"watchers":649,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/468"},"html":{"href":"https://github.com/quantumlib/OpenFermion/pull/468"},"issue":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/issues/468"},"comments":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/issues/468/comments"},"review_comments":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/468/comments"},"review_comment":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/468/commits"},"statuses":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/statuses/f98d18e21cdd285942d34ccac19e4dd7a846f792"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"obriente"}}