{"action":"created","comment":{"url":"https://api.github.com/repos/numpy/numpy/pulls/comments/115109431","pull_request_review_id":36633395,"id":115109431,"diff_hunk":"@@ -864,6 +864,20 @@ def english_upper(s):\n           TypeDescription('d', None, 'd', 'di'),\n           TypeDescription('g', None, 'g', 'gi'),\n           ],\n+          ),\n+'gcd' :\n+    Ufunc(2, 1, Zero,\n+          docstrings.get('numpy.core.umath.gcd'),\n+          \"PyUFunc_SimpleBinaryOperationTypeResolver\",\n+          TD(ints),\n+          TD('O', f='npy_ObjectGCD'),\n+          ),\n+'lcm' :\n+    Ufunc(2, 1, None,","path":"numpy/core/code_generators/generate_umath.py","position":13,"original_position":13,"commit_id":"36d6cc7c79d30d33d1e49050423301814d1cac19","original_commit_id":"36d6cc7c79d30d33d1e49050423301814d1cac19","user":{"login":"eric-wieser","id":425260,"avatar_url":"https://avatars0.githubusercontent.com/u/425260?v=3","gravatar_id":"","url":"https://api.github.com/users/eric-wieser","html_url":"https://github.com/eric-wieser","followers_url":"https://api.github.com/users/eric-wieser/followers","following_url":"https://api.github.com/users/eric-wieser/following{/other_user}","gists_url":"https://api.github.com/users/eric-wieser/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-wieser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-wieser/subscriptions","organizations_url":"https://api.github.com/users/eric-wieser/orgs","repos_url":"https://api.github.com/users/eric-wieser/repos","events_url":"https://api.github.com/users/eric-wieser/events{/privacy}","received_events_url":"https://api.github.com/users/eric-wieser/received_events","type":"User","site_admin":false},"body":"Got this wrong until now. The identity of gcd is `0` since  by definition, `gcd(a, 0) == a`.\r\n\r\nThe identity for `lcm` is some kind of epsilon. For the integers, that epsilon is simply `1`. However, for the rationals, (ie `decimal.Decimal`), this is incorrect, nor is such an epsilon really representable.","created_at":"2017-05-06T01:04:41Z","updated_at":"2017-05-06T01:04:45Z","html_url":"https://github.com/numpy/numpy/pull/8774#discussion_r115109431","pull_request_url":"https://api.github.com/repos/numpy/numpy/pulls/8774","_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments/115109431"},"html":{"href":"https://github.com/numpy/numpy/pull/8774#discussion_r115109431"},"pull_request":{"href":"https://api.github.com/repos/numpy/numpy/pulls/8774"}}},"pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/8774","id":110283922,"html_url":"https://github.com/numpy/numpy/pull/8774","diff_url":"https://github.com/numpy/numpy/pull/8774.diff","patch_url":"https://github.com/numpy/numpy/pull/8774.patch","issue_url":"https://api.github.com/repos/numpy/numpy/issues/8774","number":8774,"state":"open","locked":false,"title":"ENH: Add gcd and lcm ufuncs","user":{"login":"eric-wieser","id":425260,"avatar_url":"https://avatars0.githubusercontent.com/u/425260?v=3","gravatar_id":"","url":"https://api.github.com/users/eric-wieser","html_url":"https://github.com/eric-wieser","followers_url":"https://api.github.com/users/eric-wieser/followers","following_url":"https://api.github.com/users/eric-wieser/following{/other_user}","gists_url":"https://api.github.com/users/eric-wieser/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-wieser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-wieser/subscriptions","organizations_url":"https://api.github.com/users/eric-wieser/orgs","repos_url":"https://api.github.com/users/eric-wieser/repos","events_url":"https://api.github.com/users/eric-wieser/events{/privacy}","received_events_url":"https://api.github.com/users/eric-wieser/received_events","type":"User","site_admin":false},"body":"Fixes #8772, implementing Least Common Multiple and Greatest Common Divisor as `ufunc`s\r\n\r\nSince these are now both  in the C++17 stdlib, it seems pretty reasonable that they should be part of numpy as well. Specification matches the C++17 one, where the result is always positive.\r\n\r\nDefined for:\r\n* signed and unsigned `int`s\r\n* `object`\r\n  * builtin arbitrary-precision `long`s defer to `math.gcd` (if available)\r\n  * everything else (`Decimal`, `Fraction`, ...) defers to <s>`fraction.gcd`</s> `np.core.internal._gcd`, but enforcing consistency with `math.gcd` (returning a positive value)\r\n\r\nNot defined for:\r\n * `bool` - doesn't seem useful, since it just decays to `logical_or`\r\n * `np.inexact` - not well defined\r\n\r\n---\r\n\r\nFirst commit is some minor cleanup to make it easier to see where to add new integer ufuncs. Githubs rendering of this diff is not very clear","created_at":"2017-03-12T03:01:43Z","updated_at":"2017-05-06T01:04:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12f93133e224d8d3baf185048882a75a6444dbd6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/numpy/numpy/pulls/8774/commits","review_comments_url":"https://api.github.com/repos/numpy/numpy/pulls/8774/comments","review_comment_url":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/8774/comments","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/36d6cc7c79d30d33d1e49050423301814d1cac19","head":{"label":"eric-wieser:lcm-gcd","ref":"lcm-gcd","sha":"36d6cc7c79d30d33d1e49050423301814d1cac19","user":{"login":"eric-wieser","id":425260,"avatar_url":"https://avatars0.githubusercontent.com/u/425260?v=3","gravatar_id":"","url":"https://api.github.com/users/eric-wieser","html_url":"https://github.com/eric-wieser","followers_url":"https://api.github.com/users/eric-wieser/followers","following_url":"https://api.github.com/users/eric-wieser/following{/other_user}","gists_url":"https://api.github.com/users/eric-wieser/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-wieser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-wieser/subscriptions","organizations_url":"https://api.github.com/users/eric-wieser/orgs","repos_url":"https://api.github.com/users/eric-wieser/repos","events_url":"https://api.github.com/users/eric-wieser/events{/privacy}","received_events_url":"https://api.github.com/users/eric-wieser/received_events","type":"User","site_admin":false},"repo":{"id":57262933,"name":"numpy","full_name":"eric-wieser/numpy","owner":{"login":"eric-wieser","id":425260,"avatar_url":"https://avatars0.githubusercontent.com/u/425260?v=3","gravatar_id":"","url":"https://api.github.com/users/eric-wieser","html_url":"https://github.com/eric-wieser","followers_url":"https://api.github.com/users/eric-wieser/followers","following_url":"https://api.github.com/users/eric-wieser/following{/other_user}","gists_url":"https://api.github.com/users/eric-wieser/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-wieser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-wieser/subscriptions","organizations_url":"https://api.github.com/users/eric-wieser/orgs","repos_url":"https://api.github.com/users/eric-wieser/repos","events_url":"https://api.github.com/users/eric-wieser/events{/privacy}","received_events_url":"https://api.github.com/users/eric-wieser/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eric-wieser/numpy","description":"Numpy main repository","fork":true,"url":"https://api.github.com/repos/eric-wieser/numpy","forks_url":"https://api.github.com/repos/eric-wieser/numpy/forks","keys_url":"https://api.github.com/repos/eric-wieser/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eric-wieser/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eric-wieser/numpy/teams","hooks_url":"https://api.github.com/repos/eric-wieser/numpy/hooks","issue_events_url":"https://api.github.com/repos/eric-wieser/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/eric-wieser/numpy/events","assignees_url":"https://api.github.com/repos/eric-wieser/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/eric-wieser/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/eric-wieser/numpy/tags","blobs_url":"https://api.github.com/repos/eric-wieser/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eric-wieser/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eric-wieser/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/eric-wieser/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eric-wieser/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/eric-wieser/numpy/languages","stargazers_url":"https://api.github.com/repos/eric-wieser/numpy/stargazers","contributors_url":"https://api.github.com/repos/eric-wieser/numpy/contributors","subscribers_url":"https://api.github.com/repos/eric-wieser/numpy/subscribers","subscription_url":"https://api.github.com/repos/eric-wieser/numpy/subscription","commits_url":"https://api.github.com/repos/eric-wieser/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/eric-wieser/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/eric-wieser/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/eric-wieser/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/eric-wieser/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/eric-wieser/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eric-wieser/numpy/merges","archive_url":"https://api.github.com/repos/eric-wieser/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eric-wieser/numpy/downloads","issues_url":"https://api.github.com/repos/eric-wieser/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/eric-wieser/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/eric-wieser/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/eric-wieser/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eric-wieser/numpy/labels{/name}","releases_url":"https://api.github.com/repos/eric-wieser/numpy/releases{/id}","deployments_url":"https://api.github.com/repos/eric-wieser/numpy/deployments","created_at":"2016-04-28T02:09:21Z","updated_at":"2017-04-11T14:13:45Z","pushed_at":"2017-05-06T01:01:27Z","git_url":"git://github.com/eric-wieser/numpy.git","ssh_url":"git@github.com:eric-wieser/numpy.git","clone_url":"https://github.com/eric-wieser/numpy.git","svn_url":"https://github.com/eric-wieser/numpy","homepage":"http://www.numpy.org/","size":48534,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"numpy:master","ref":"master","sha":"491ddf4cbf18256d1578aea60c58888920895ef0","user":{"login":"numpy","id":288276,"avatar_url":"https://avatars1.githubusercontent.com/u/288276?v=3","gravatar_id":"","url":"https://api.github.com/users/numpy","html_url":"https://github.com/numpy","followers_url":"https://api.github.com/users/numpy/followers","following_url":"https://api.github.com/users/numpy/following{/other_user}","gists_url":"https://api.github.com/users/numpy/gists{/gist_id}","starred_url":"https://api.github.com/users/numpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numpy/subscriptions","organizations_url":"https://api.github.com/users/numpy/orgs","repos_url":"https://api.github.com/users/numpy/repos","events_url":"https://api.github.com/users/numpy/events{/privacy}","received_events_url":"https://api.github.com/users/numpy/received_events","type":"Organization","site_admin":false},"repo":{"id":908607,"name":"numpy","full_name":"numpy/numpy","owner":{"login":"numpy","id":288276,"avatar_url":"https://avatars1.githubusercontent.com/u/288276?v=3","gravatar_id":"","url":"https://api.github.com/users/numpy","html_url":"https://github.com/numpy","followers_url":"https://api.github.com/users/numpy/followers","following_url":"https://api.github.com/users/numpy/following{/other_user}","gists_url":"https://api.github.com/users/numpy/gists{/gist_id}","starred_url":"https://api.github.com/users/numpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numpy/subscriptions","organizations_url":"https://api.github.com/users/numpy/orgs","repos_url":"https://api.github.com/users/numpy/repos","events_url":"https://api.github.com/users/numpy/events{/privacy}","received_events_url":"https://api.github.com/users/numpy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/numpy/numpy","description":"Numpy main repository","fork":false,"url":"https://api.github.com/repos/numpy/numpy","forks_url":"https://api.github.com/repos/numpy/numpy/forks","keys_url":"https://api.github.com/repos/numpy/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/numpy/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/numpy/numpy/teams","hooks_url":"https://api.github.com/repos/numpy/numpy/hooks","issue_events_url":"https://api.github.com/repos/numpy/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/numpy/numpy/events","assignees_url":"https://api.github.com/repos/numpy/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/numpy/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/numpy/numpy/tags","blobs_url":"https://api.github.com/repos/numpy/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/numpy/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/numpy/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/numpy/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/numpy/numpy/languages","stargazers_url":"https://api.github.com/repos/numpy/numpy/stargazers","contributors_url":"https://api.github.com/repos/numpy/numpy/contributors","subscribers_url":"https://api.github.com/repos/numpy/numpy/subscribers","subscription_url":"https://api.github.com/repos/numpy/numpy/subscription","commits_url":"https://api.github.com/repos/numpy/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/numpy/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/numpy/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/numpy/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/numpy/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/numpy/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/numpy/numpy/merges","archive_url":"https://api.github.com/repos/numpy/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/numpy/numpy/downloads","issues_url":"https://api.github.com/repos/numpy/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/numpy/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/numpy/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/numpy/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/numpy/numpy/labels{/name}","releases_url":"https://api.github.com/repos/numpy/numpy/releases{/id}","deployments_url":"https://api.github.com/repos/numpy/numpy/deployments","created_at":"2010-09-13T23:02:39Z","updated_at":"2017-05-05T20:40:10Z","pushed_at":"2017-05-06T01:01:28Z","git_url":"git://github.com/numpy/numpy.git","ssh_url":"git@github.com:numpy/numpy.git","clone_url":"https://github.com/numpy/numpy.git","svn_url":"https://github.com/numpy/numpy","homepage":"http://www.numpy.org/","size":49656,"stargazers_count":4339,"watchers_count":4339,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2029,"mirror_url":null,"open_issues_count":1521,"forks":2029,"open_issues":1521,"watchers":4339,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/8774"},"html":{"href":"https://github.com/numpy/numpy/pull/8774"},"issue":{"href":"https://api.github.com/repos/numpy/numpy/issues/8774"},"comments":{"href":"https://api.github.com/repos/numpy/numpy/issues/8774/comments"},"review_comments":{"href":"https://api.github.com/repos/numpy/numpy/pulls/8774/comments"},"review_comment":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/numpy/numpy/pulls/8774/commits"},"statuses":{"href":"https://api.github.com/repos/numpy/numpy/statuses/36d6cc7c79d30d33d1e49050423301814d1cac19"}}}}
{"actor":{"display_login":"eric-wieser"}}