{"action":"created","comment":{"url":"https://api.github.com/repos/quantumlib/Cirq/pulls/comments/239279768","pull_request_review_id":182024997,"id":239279768,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzOTI3OTc2OA==","diff_hunk":"@@ -0,0 +1,175 @@\n+# Copyright 2018 The Cirq Developers\n+#\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+#     https://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+\"\"\"Classes to represent displays.\n+\n+A Display is an operation that signifies extracting some information about the\n+qubits it is applied to without actually performing any effect on those qubits.\n+Each Display in a circuit has an associated key, and the result of computing\n+the values of Displays in a circuit is a dictionary from Display key to\n+Display value.\n+\"\"\"\n+\n+from typing import Any, Dict, Hashable, Tuple, TYPE_CHECKING\n+\n+import abc\n+\n+import numpy as np\n+\n+from cirq import protocols, value\n+from cirq.ops import raw_types, op_tree\n+\n+if TYPE_CHECKING:\n+    # pylint: disable=unused-import\n+    from cirq.ops import pauli_string\n+\n+\n+class SamplesDisplay(raw_types.Operation):\n+    \"\"\"A display whose value is computed from measurement results.\n+\n+    The value of a SamplesDisplay on some qubits is computed in the following\n+    steps:\n+        1. Perform some unitary operations on the qubits\n+        2. Sample bitstrings from the resulting state a number of times\n+        3. Apply a function to the sampled bitstrings\n+    \"\"\"\n+\n+    @property\n+    @abc.abstractmethod\n+    def key(self) -> Hashable:\n+        pass\n+\n+    @abc.abstractmethod\n+    def measurement_basis_change(self) -> op_tree.OP_TREE:\n+        \"\"\"Operations to perform prior to measurement.\"\"\"\n+        pass\n+\n+    @property\n+    @abc.abstractmethod\n+    def repetitions(self) -> int:\n+        \"\"\"The number of measurement samples to take.\"\"\"\n+        pass\n+\n+    @abc.abstractmethod\n+    def value(self,\n+              measurements: np.ndarray) -> Any:\n+        \"\"\"The value of the display.\"\"\"\n+        pass\n+\n+\n+class WaveFunctionDisplay(raw_types.Operation):\n+    \"\"\"A display whose value is computed from the full wavefunction.\"\"\"\n+\n+    @property\n+    @abc.abstractmethod\n+    def key(self) -> Hashable:\n+        pass\n+\n+    @abc.abstractmethod\n+    def value(self,","path":"cirq/ops/display.py","position":80,"original_position":80,"commit_id":"2b0a78e87a04048a61317d9b8805c0df22211a3b","original_commit_id":"2b0a78e87a04048a61317d9b8805c0df22211a3b","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},"body":"`value_derived_from_wavefunction` or similar.","created_at":"2018-12-05T23:37:08Z","updated_at":"2018-12-05T23:47:03Z","html_url":"https://github.com/quantumlib/Cirq/pull/1221#discussion_r239279768","pull_request_url":"https://api.github.com/repos/quantumlib/Cirq/pulls/1221","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/quantumlib/Cirq/pulls/comments/239279768"},"html":{"href":"https://github.com/quantumlib/Cirq/pull/1221#discussion_r239279768"},"pull_request":{"href":"https://api.github.com/repos/quantumlib/Cirq/pulls/1221"}}},"pull_request":{"url":"https://api.github.com/repos/quantumlib/Cirq/pulls/1221","id":235945270,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1OTQ1Mjcw","html_url":"https://github.com/quantumlib/Cirq/pull/1221","diff_url":"https://github.com/quantumlib/Cirq/pull/1221.diff","patch_url":"https://github.com/quantumlib/Cirq/pull/1221.patch","issue_url":"https://api.github.com/repos/quantumlib/Cirq/issues/1221","number":1221,"state":"open","locked":false,"title":"Define SamplesDisplay, WaveFunctionDisplay, and Pauli string expectations","user":{"login":"kevinsung","id":4296166,"node_id":"MDQ6VXNlcjQyOTYxNjY=","avatar_url":"https://avatars1.githubusercontent.com/u/4296166?v=4","gravatar_id":"","url":"https://api.github.com/users/kevinsung","html_url":"https://github.com/kevinsung","followers_url":"https://api.github.com/users/kevinsung/followers","following_url":"https://api.github.com/users/kevinsung/following{/other_user}","gists_url":"https://api.github.com/users/kevinsung/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinsung/subscriptions","organizations_url":"https://api.github.com/users/kevinsung/orgs","repos_url":"https://api.github.com/users/kevinsung/repos","events_url":"https://api.github.com/users/kevinsung/events{/privacy}","received_events_url":"https://api.github.com/users/kevinsung/received_events","type":"User","site_admin":false},"body":"Fixes #982 \r\n\r\nPeeled off of #1215 ","created_at":"2018-12-04T20:16:33Z","updated_at":"2018-12-05T23:47:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7fc401954af83dc997d87923f35fef5ea065350f","assignee":null,"assignees":[],"requested_reviewers":[{"login":"dabacon","id":87974,"node_id":"MDQ6VXNlcjg3OTc0","avatar_url":"https://avatars0.githubusercontent.com/u/87974?v=4","gravatar_id":"","url":"https://api.github.com/users/dabacon","html_url":"https://github.com/dabacon","followers_url":"https://api.github.com/users/dabacon/followers","following_url":"https://api.github.com/users/dabacon/following{/other_user}","gists_url":"https://api.github.com/users/dabacon/gists{/gist_id}","starred_url":"https://api.github.com/users/dabacon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabacon/subscriptions","organizations_url":"https://api.github.com/users/dabacon/orgs","repos_url":"https://api.github.com/users/dabacon/repos","events_url":"https://api.github.com/users/dabacon/events{/privacy}","received_events_url":"https://api.github.com/users/dabacon/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":922112536,"node_id":"MDU6TGFiZWw5MjIxMTI1MzY=","url":"https://api.github.com/repos/quantumlib/Cirq/labels/cla:%20yes","name":"cla: yes","color":"FFFFFF","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/quantumlib/Cirq/pulls/1221/commits","review_comments_url":"https://api.github.com/repos/quantumlib/Cirq/pulls/1221/comments","review_comment_url":"https://api.github.com/repos/quantumlib/Cirq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/quantumlib/Cirq/issues/1221/comments","statuses_url":"https://api.github.com/repos/quantumlib/Cirq/statuses/2b0a78e87a04048a61317d9b8805c0df22211a3b","head":{"label":"kevinsung:define_display","ref":"define_display","sha":"2b0a78e87a04048a61317d9b8805c0df22211a3b","user":{"login":"kevinsung","id":4296166,"node_id":"MDQ6VXNlcjQyOTYxNjY=","avatar_url":"https://avatars1.githubusercontent.com/u/4296166?v=4","gravatar_id":"","url":"https://api.github.com/users/kevinsung","html_url":"https://github.com/kevinsung","followers_url":"https://api.github.com/users/kevinsung/followers","following_url":"https://api.github.com/users/kevinsung/following{/other_user}","gists_url":"https://api.github.com/users/kevinsung/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinsung/subscriptions","organizations_url":"https://api.github.com/users/kevinsung/orgs","repos_url":"https://api.github.com/users/kevinsung/repos","events_url":"https://api.github.com/users/kevinsung/events{/privacy}","received_events_url":"https://api.github.com/users/kevinsung/received_events","type":"User","site_admin":false},"repo":{"id":143246355,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMyNDYzNTU=","name":"Cirq","full_name":"kevinsung/Cirq","private":false,"owner":{"login":"kevinsung","id":4296166,"node_id":"MDQ6VXNlcjQyOTYxNjY=","avatar_url":"https://avatars1.githubusercontent.com/u/4296166?v=4","gravatar_id":"","url":"https://api.github.com/users/kevinsung","html_url":"https://github.com/kevinsung","followers_url":"https://api.github.com/users/kevinsung/followers","following_url":"https://api.github.com/users/kevinsung/following{/other_user}","gists_url":"https://api.github.com/users/kevinsung/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinsung/subscriptions","organizations_url":"https://api.github.com/users/kevinsung/orgs","repos_url":"https://api.github.com/users/kevinsung/repos","events_url":"https://api.github.com/users/kevinsung/events{/privacy}","received_events_url":"https://api.github.com/users/kevinsung/received_events","type":"User","site_admin":false},"html_url":"https://github.com/kevinsung/Cirq","description":"A python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.","fork":true,"url":"https://api.github.com/repos/kevinsung/Cirq","forks_url":"https://api.github.com/repos/kevinsung/Cirq/forks","keys_url":"https://api.github.com/repos/kevinsung/Cirq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kevinsung/Cirq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kevinsung/Cirq/teams","hooks_url":"https://api.github.com/repos/kevinsung/Cirq/hooks","issue_events_url":"https://api.github.com/repos/kevinsung/Cirq/issues/events{/number}","events_url":"https://api.github.com/repos/kevinsung/Cirq/events","assignees_url":"https://api.github.com/repos/kevinsung/Cirq/assignees{/user}","branches_url":"https://api.github.com/repos/kevinsung/Cirq/branches{/branch}","tags_url":"https://api.github.com/repos/kevinsung/Cirq/tags","blobs_url":"https://api.github.com/repos/kevinsung/Cirq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kevinsung/Cirq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kevinsung/Cirq/git/refs{/sha}","trees_url":"https://api.github.com/repos/kevinsung/Cirq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kevinsung/Cirq/statuses/{sha}","languages_url":"https://api.github.com/repos/kevinsung/Cirq/languages","stargazers_url":"https://api.github.com/repos/kevinsung/Cirq/stargazers","contributors_url":"https://api.github.com/repos/kevinsung/Cirq/contributors","subscribers_url":"https://api.github.com/repos/kevinsung/Cirq/subscribers","subscription_url":"https://api.github.com/repos/kevinsung/Cirq/subscription","commits_url":"https://api.github.com/repos/kevinsung/Cirq/commits{/sha}","git_commits_url":"https://api.github.com/repos/kevinsung/Cirq/git/commits{/sha}","comments_url":"https://api.github.com/repos/kevinsung/Cirq/comments{/number}","issue_comment_url":"https://api.github.com/repos/kevinsung/Cirq/issues/comments{/number}","contents_url":"https://api.github.com/repos/kevinsung/Cirq/contents/{+path}","compare_url":"https://api.github.com/repos/kevinsung/Cirq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kevinsung/Cirq/merges","archive_url":"https://api.github.com/repos/kevinsung/Cirq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kevinsung/Cirq/downloads","issues_url":"https://api.github.com/repos/kevinsung/Cirq/issues{/number}","pulls_url":"https://api.github.com/repos/kevinsung/Cirq/pulls{/number}","milestones_url":"https://api.github.com/repos/kevinsung/Cirq/milestones{/number}","notifications_url":"https://api.github.com/repos/kevinsung/Cirq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kevinsung/Cirq/labels{/name}","releases_url":"https://api.github.com/repos/kevinsung/Cirq/releases{/id}","deployments_url":"https://api.github.com/repos/kevinsung/Cirq/deployments","created_at":"2018-08-02T05:25:07Z","updated_at":"2018-12-03T04:38:00Z","pushed_at":"2018-12-04T22:29:04Z","git_url":"git://github.com/kevinsung/Cirq.git","ssh_url":"git@github.com:kevinsung/Cirq.git","clone_url":"https://github.com/kevinsung/Cirq.git","svn_url":"https://github.com/kevinsung/Cirq","homepage":"","size":2945,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"ea6c0b083e23aeca1426d75e107a919e75f53281","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":114306758,"node_id":"MDEwOlJlcG9zaXRvcnkxMTQzMDY3NTg=","name":"Cirq","full_name":"quantumlib/Cirq","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/Cirq","description":"A python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.","fork":false,"url":"https://api.github.com/repos/quantumlib/Cirq","forks_url":"https://api.github.com/repos/quantumlib/Cirq/forks","keys_url":"https://api.github.com/repos/quantumlib/Cirq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/quantumlib/Cirq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/quantumlib/Cirq/teams","hooks_url":"https://api.github.com/repos/quantumlib/Cirq/hooks","issue_events_url":"https://api.github.com/repos/quantumlib/Cirq/issues/events{/number}","events_url":"https://api.github.com/repos/quantumlib/Cirq/events","assignees_url":"https://api.github.com/repos/quantumlib/Cirq/assignees{/user}","branches_url":"https://api.github.com/repos/quantumlib/Cirq/branches{/branch}","tags_url":"https://api.github.com/repos/quantumlib/Cirq/tags","blobs_url":"https://api.github.com/repos/quantumlib/Cirq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/quantumlib/Cirq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/quantumlib/Cirq/git/refs{/sha}","trees_url":"https://api.github.com/repos/quantumlib/Cirq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/quantumlib/Cirq/statuses/{sha}","languages_url":"https://api.github.com/repos/quantumlib/Cirq/languages","stargazers_url":"https://api.github.com/repos/quantumlib/Cirq/stargazers","contributors_url":"https://api.github.com/repos/quantumlib/Cirq/contributors","subscribers_url":"https://api.github.com/repos/quantumlib/Cirq/subscribers","subscription_url":"https://api.github.com/repos/quantumlib/Cirq/subscription","commits_url":"https://api.github.com/repos/quantumlib/Cirq/commits{/sha}","git_commits_url":"https://api.github.com/repos/quantumlib/Cirq/git/commits{/sha}","comments_url":"https://api.github.com/repos/quantumlib/Cirq/comments{/number}","issue_comment_url":"https://api.github.com/repos/quantumlib/Cirq/issues/comments{/number}","contents_url":"https://api.github.com/repos/quantumlib/Cirq/contents/{+path}","compare_url":"https://api.github.com/repos/quantumlib/Cirq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/quantumlib/Cirq/merges","archive_url":"https://api.github.com/repos/quantumlib/Cirq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/quantumlib/Cirq/downloads","issues_url":"https://api.github.com/repos/quantumlib/Cirq/issues{/number}","pulls_url":"https://api.github.com/repos/quantumlib/Cirq/pulls{/number}","milestones_url":"https://api.github.com/repos/quantumlib/Cirq/milestones{/number}","notifications_url":"https://api.github.com/repos/quantumlib/Cirq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/quantumlib/Cirq/labels{/name}","releases_url":"https://api.github.com/repos/quantumlib/Cirq/releases{/id}","deployments_url":"https://api.github.com/repos/quantumlib/Cirq/deployments","created_at":"2017-12-14T23:41:49Z","updated_at":"2018-12-05T23:37:25Z","pushed_at":"2018-12-05T23:37:23Z","git_url":"git://github.com/quantumlib/Cirq.git","ssh_url":"git@github.com:quantumlib/Cirq.git","clone_url":"https://github.com/quantumlib/Cirq.git","svn_url":"https://github.com/quantumlib/Cirq","homepage":"","size":3018,"stargazers_count":1250,"watchers_count":1250,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":179,"mirror_url":null,"archived":false,"open_issues_count":201,"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":179,"open_issues":201,"watchers":1250,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/quantumlib/Cirq/pulls/1221"},"html":{"href":"https://github.com/quantumlib/Cirq/pull/1221"},"issue":{"href":"https://api.github.com/repos/quantumlib/Cirq/issues/1221"},"comments":{"href":"https://api.github.com/repos/quantumlib/Cirq/issues/1221/comments"},"review_comments":{"href":"https://api.github.com/repos/quantumlib/Cirq/pulls/1221/comments"},"review_comment":{"href":"https://api.github.com/repos/quantumlib/Cirq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/quantumlib/Cirq/pulls/1221/commits"},"statuses":{"href":"https://api.github.com/repos/quantumlib/Cirq/statuses/2b0a78e87a04048a61317d9b8805c0df22211a3b"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Strilanc"}}