{"action":"created","comment":{"url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments/210735076","pull_request_review_id":147015616,"id":210735076,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDczNTA3Ng==","diff_hunk":"@@ -158,17 +158,20 @@ def low_rank_two_body_decomposition(two_body_coefficients,\n     truncation_errors = cumulative_error_sum[-1] - cumulative_error_sum\n \n     # Optionally truncate rank and return.\n-    if truncation_threshold is None and final_rank is None:\n-        max_rank = full_rank\n-    elif truncation_threshold is None:\n-        max_rank = final_rank\n-    elif final_rank is None:\n-        max_rank = 1 + numpy.argmax(truncation_errors <= truncation_threshold)\n+    if truncation_threshold is None:\n+        if final_rank is None:\n+            raise ValueError(\n+                'Must provide either final_rank or truncation_value.')\n+        else:\n+            max_rank = final_rank\n     else:\n-        raise ValueError(\n-            'Cannot provide both final_rank and truncation_value.')\n+        if final_rank is None:\n+            max_rank = 1 + numpy.argmax(\n+                truncation_errors <= truncation_threshold)\n+        else:\n+            max_rank = min(1 + numpy.argmax(\n+                truncation_errors <= truncation_threshold), final_rank)","path":"src/openfermion/utils/_low_rank.py","position":358,"original_position":33,"commit_id":"cc6e71178890333db801120b1b14138d5a34c8fa","original_commit_id":"cc6e71178890333db801120b1b14138d5a34c8fa","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":"Let's just enforce that `truncation_threshold` must be a float. I don't see a reason to allow passing `None`.","created_at":"2018-08-16T20:42:05Z","updated_at":"2018-08-16T20:42:05Z","html_url":"https://github.com/quantumlib/OpenFermion/pull/434#discussion_r210735076","pull_request_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/434","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments/210735076"},"html":{"href":"https://github.com/quantumlib/OpenFermion/pull/434#discussion_r210735076"},"pull_request":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/434"}}},"pull_request":{"url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/434","id":208691676,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4NjkxNjc2","html_url":"https://github.com/quantumlib/OpenFermion/pull/434","diff_url":"https://github.com/quantumlib/OpenFermion/pull/434.diff","patch_url":"https://github.com/quantumlib/OpenFermion/pull/434.patch","issue_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/434","number":434,"state":"open","locked":false,"title":"removed non-spatial low rank code","user":{"login":"babbush","id":14242687,"node_id":"MDQ6VXNlcjE0MjQyNjg3","avatar_url":"https://avatars2.githubusercontent.com/u/14242687?v=4","gravatar_id":"","url":"https://api.github.com/users/babbush","html_url":"https://github.com/babbush","followers_url":"https://api.github.com/users/babbush/followers","following_url":"https://api.github.com/users/babbush/following{/other_user}","gists_url":"https://api.github.com/users/babbush/gists{/gist_id}","starred_url":"https://api.github.com/users/babbush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babbush/subscriptions","organizations_url":"https://api.github.com/users/babbush/orgs","repos_url":"https://api.github.com/users/babbush/repos","events_url":"https://api.github.com/users/babbush/events{/privacy}","received_events_url":"https://api.github.com/users/babbush/received_events","type":"User","site_admin":false},"body":"* Removes non-spatial low rank code.\r\n* Fixes testing utility that was generating InteractionOperators without 8-fold symmetry.\r\n* Switches to using exact diagonalization instead of LDL.\r\n* Code now throws an error when eigenvectors of first diagonalization are non-Hermitian.","created_at":"2018-08-15T21:51:25Z","updated_at":"2018-08-16T20:42:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0926b2cc3e3b94121ec7fcc5a9ab8873fd7f3bab","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/434/commits","review_comments_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/434/comments","review_comment_url":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/434/comments","statuses_url":"https://api.github.com/repos/quantumlib/OpenFermion/statuses/cc6e71178890333db801120b1b14138d5a34c8fa","head":{"label":"babbush:remove_spinful_low_rank","ref":"remove_spinful_low_rank","sha":"cc6e71178890333db801120b1b14138d5a34c8fa","user":{"login":"babbush","id":14242687,"node_id":"MDQ6VXNlcjE0MjQyNjg3","avatar_url":"https://avatars2.githubusercontent.com/u/14242687?v=4","gravatar_id":"","url":"https://api.github.com/users/babbush","html_url":"https://github.com/babbush","followers_url":"https://api.github.com/users/babbush/followers","following_url":"https://api.github.com/users/babbush/following{/other_user}","gists_url":"https://api.github.com/users/babbush/gists{/gist_id}","starred_url":"https://api.github.com/users/babbush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babbush/subscriptions","organizations_url":"https://api.github.com/users/babbush/orgs","repos_url":"https://api.github.com/users/babbush/repos","events_url":"https://api.github.com/users/babbush/events{/privacy}","received_events_url":"https://api.github.com/users/babbush/received_events","type":"User","site_admin":false},"repo":{"id":105316591,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUzMTY1OTE=","name":"OpenFermion","full_name":"babbush/OpenFermion","owner":{"login":"babbush","id":14242687,"node_id":"MDQ6VXNlcjE0MjQyNjg3","avatar_url":"https://avatars2.githubusercontent.com/u/14242687?v=4","gravatar_id":"","url":"https://api.github.com/users/babbush","html_url":"https://github.com/babbush","followers_url":"https://api.github.com/users/babbush/followers","following_url":"https://api.github.com/users/babbush/following{/other_user}","gists_url":"https://api.github.com/users/babbush/gists{/gist_id}","starred_url":"https://api.github.com/users/babbush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babbush/subscriptions","organizations_url":"https://api.github.com/users/babbush/orgs","repos_url":"https://api.github.com/users/babbush/repos","events_url":"https://api.github.com/users/babbush/events{/privacy}","received_events_url":"https://api.github.com/users/babbush/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/babbush/OpenFermion","description":"OpenFermion: the electronic structure package for quantum computers.","fork":true,"url":"https://api.github.com/repos/babbush/OpenFermion","forks_url":"https://api.github.com/repos/babbush/OpenFermion/forks","keys_url":"https://api.github.com/repos/babbush/OpenFermion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/babbush/OpenFermion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/babbush/OpenFermion/teams","hooks_url":"https://api.github.com/repos/babbush/OpenFermion/hooks","issue_events_url":"https://api.github.com/repos/babbush/OpenFermion/issues/events{/number}","events_url":"https://api.github.com/repos/babbush/OpenFermion/events","assignees_url":"https://api.github.com/repos/babbush/OpenFermion/assignees{/user}","branches_url":"https://api.github.com/repos/babbush/OpenFermion/branches{/branch}","tags_url":"https://api.github.com/repos/babbush/OpenFermion/tags","blobs_url":"https://api.github.com/repos/babbush/OpenFermion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/babbush/OpenFermion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/babbush/OpenFermion/git/refs{/sha}","trees_url":"https://api.github.com/repos/babbush/OpenFermion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/babbush/OpenFermion/statuses/{sha}","languages_url":"https://api.github.com/repos/babbush/OpenFermion/languages","stargazers_url":"https://api.github.com/repos/babbush/OpenFermion/stargazers","contributors_url":"https://api.github.com/repos/babbush/OpenFermion/contributors","subscribers_url":"https://api.github.com/repos/babbush/OpenFermion/subscribers","subscription_url":"https://api.github.com/repos/babbush/OpenFermion/subscription","commits_url":"https://api.github.com/repos/babbush/OpenFermion/commits{/sha}","git_commits_url":"https://api.github.com/repos/babbush/OpenFermion/git/commits{/sha}","comments_url":"https://api.github.com/repos/babbush/OpenFermion/comments{/number}","issue_comment_url":"https://api.github.com/repos/babbush/OpenFermion/issues/comments{/number}","contents_url":"https://api.github.com/repos/babbush/OpenFermion/contents/{+path}","compare_url":"https://api.github.com/repos/babbush/OpenFermion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/babbush/OpenFermion/merges","archive_url":"https://api.github.com/repos/babbush/OpenFermion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/babbush/OpenFermion/downloads","issues_url":"https://api.github.com/repos/babbush/OpenFermion/issues{/number}","pulls_url":"https://api.github.com/repos/babbush/OpenFermion/pulls{/number}","milestones_url":"https://api.github.com/repos/babbush/OpenFermion/milestones{/number}","notifications_url":"https://api.github.com/repos/babbush/OpenFermion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/babbush/OpenFermion/labels{/name}","releases_url":"https://api.github.com/repos/babbush/OpenFermion/releases{/id}","deployments_url":"https://api.github.com/repos/babbush/OpenFermion/deployments","created_at":"2017-09-29T20:58:43Z","updated_at":"2018-08-15T16:31:51Z","pushed_at":"2018-08-16T20:30:58Z","git_url":"git://github.com/babbush/OpenFermion.git","ssh_url":"git@github.com:babbush/OpenFermion.git","clone_url":"https://github.com/babbush/OpenFermion.git","svn_url":"https://github.com/babbush/OpenFermion","homepage":"","size":3718,"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":"8f7234170f3bb2848fc835621c5f1ff11592a4bc","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","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},"private":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-08-14T22:19:49Z","pushed_at":"2018-08-16T20:30:59Z","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":3596,"stargazers_count":591,"watchers_count":591,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":142,"mirror_url":null,"archived":false,"open_issues_count":37,"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":142,"open_issues":37,"watchers":591,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/434"},"html":{"href":"https://github.com/quantumlib/OpenFermion/pull/434"},"issue":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/issues/434"},"comments":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/issues/434/comments"},"review_comments":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/434/comments"},"review_comment":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/pulls/434/commits"},"statuses":{"href":"https://api.github.com/repos/quantumlib/OpenFermion/statuses/cc6e71178890333db801120b1b14138d5a34c8fa"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kevinsung"}}