{"action":"created","comment":{"url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/comments/221823455","pull_request_review_id":160562185,"id":221823455,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTgyMzQ1NQ==","diff_hunk":"@@ -0,0 +1,46 @@\n+import numpy as np\n+from scipy.fftpack import fft, ifft\n+\n+def conv(signal1, signal2):\n+    \"\"\"Discrete convolution by definition\"\"\"\n+    \n+    out = []\n+    n = min(len(signal1), len(signal2))\n+\n+    for i in range(n):\n+        s = 0\n+        for j in range(n):\n+            s += signal1[j] * signal2[i - j]\n+        out.append(s)\n+\n+    return out\n+\n+def conv_fft(signal1, signal2):\n+    \"\"\"Convolution using fft and convolutional theorem\"\"\"\n+    \n+    fft_s1 = fft(signal1)\n+    fft_s2 = fft(signal2)\n+    out = []\n+\n+    for i in range(min(len(signal1), len(signal2))):\n+        out.append(fft_s1[i] * fft_s2[i])\n+\n+    return ifft(out)\n+\n+\n+def main():\n+    # Example convolution with sin and cos\n+    x = np.linspace(0, 1, 5)\n+    s1 = np.sin(x)\n+    s2 = np.cos(x)","path":"contents/convolutions/code/python/conv.py","position":35,"original_position":35,"commit_id":"d92856964c3609bfc8241a9c78574825d50eb0f0","original_commit_id":"d92856964c3609bfc8241a9c78574825d50eb0f0","user":{"login":"jiegillet","id":16929078,"node_id":"MDQ6VXNlcjE2OTI5MDc4","avatar_url":"https://avatars2.githubusercontent.com/u/16929078?v=4","gravatar_id":"","url":"https://api.github.com/users/jiegillet","html_url":"https://github.com/jiegillet","followers_url":"https://api.github.com/users/jiegillet/followers","following_url":"https://api.github.com/users/jiegillet/following{/other_user}","gists_url":"https://api.github.com/users/jiegillet/gists{/gist_id}","starred_url":"https://api.github.com/users/jiegillet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiegillet/subscriptions","organizations_url":"https://api.github.com/users/jiegillet/orgs","repos_url":"https://api.github.com/users/jiegillet/repos","events_url":"https://api.github.com/users/jiegillet/events{/privacy}","received_events_url":"https://api.github.com/users/jiegillet/received_events","type":"User","site_admin":false},"body":"I think you can get away with something like `s1 = [ math.sin(x) for x in range(5)]` if we want to skip numpy. ","created_at":"2018-10-02T04:38:30Z","updated_at":"2018-10-02T04:40:18Z","html_url":"https://github.com/algorithm-archivists/algorithm-archive/pull/408#discussion_r221823455","pull_request_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/408","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/comments/221823455"},"html":{"href":"https://github.com/algorithm-archivists/algorithm-archive/pull/408#discussion_r221823455"},"pull_request":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/408"}}},"pull_request":{"url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/408","id":219444232,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5NDQ0MjMy","html_url":"https://github.com/algorithm-archivists/algorithm-archive/pull/408","diff_url":"https://github.com/algorithm-archivists/algorithm-archive/pull/408.diff","patch_url":"https://github.com/algorithm-archivists/algorithm-archive/pull/408.patch","issue_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues/408","number":408,"state":"open","locked":false,"title":"Implement conv in python","user":{"login":"jasmaa","id":19419059,"node_id":"MDQ6VXNlcjE5NDE5MDU5","avatar_url":"https://avatars2.githubusercontent.com/u/19419059?v=4","gravatar_id":"","url":"https://api.github.com/users/jasmaa","html_url":"https://github.com/jasmaa","followers_url":"https://api.github.com/users/jasmaa/followers","following_url":"https://api.github.com/users/jasmaa/following{/other_user}","gists_url":"https://api.github.com/users/jasmaa/gists{/gist_id}","starred_url":"https://api.github.com/users/jasmaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasmaa/subscriptions","organizations_url":"https://api.github.com/users/jasmaa/orgs","repos_url":"https://api.github.com/users/jasmaa/repos","events_url":"https://api.github.com/users/jasmaa/events{/privacy}","received_events_url":"https://api.github.com/users/jasmaa/received_events","type":"User","site_admin":false},"body":"Note: Discrete convolution implemented differently because I couldn't get the previous implementations to get the same answer as the fft ones.","created_at":"2018-10-01T16:51:28Z","updated_at":"2018-10-02T04:40:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b9a6f6dcea6add5e8a285df3b88fd96662a930e1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1073065218,"node_id":"MDU6TGFiZWwxMDczMDY1MjE4","url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/labels/Hacktoberfest","name":"Hacktoberfest","color":"59273e","default":false},{"id":917133710,"node_id":"MDU6TGFiZWw5MTcxMzM3MTA=","url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/labels/Implementation","name":"Implementation","color":"0960e2","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/408/commits","review_comments_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/408/comments","review_comment_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/comments{/number}","comments_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues/408/comments","statuses_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/statuses/d92856964c3609bfc8241a9c78574825d50eb0f0","head":{"label":"jasmaa:conv-python","ref":"conv-python","sha":"d92856964c3609bfc8241a9c78574825d50eb0f0","user":{"login":"jasmaa","id":19419059,"node_id":"MDQ6VXNlcjE5NDE5MDU5","avatar_url":"https://avatars2.githubusercontent.com/u/19419059?v=4","gravatar_id":"","url":"https://api.github.com/users/jasmaa","html_url":"https://github.com/jasmaa","followers_url":"https://api.github.com/users/jasmaa/followers","following_url":"https://api.github.com/users/jasmaa/following{/other_user}","gists_url":"https://api.github.com/users/jasmaa/gists{/gist_id}","starred_url":"https://api.github.com/users/jasmaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasmaa/subscriptions","organizations_url":"https://api.github.com/users/jasmaa/orgs","repos_url":"https://api.github.com/users/jasmaa/repos","events_url":"https://api.github.com/users/jasmaa/events{/privacy}","received_events_url":"https://api.github.com/users/jasmaa/received_events","type":"User","site_admin":false},"repo":{"id":145986118,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU5ODYxMTg=","name":"algorithm-archive","full_name":"jasmaa/algorithm-archive","private":false,"owner":{"login":"jasmaa","id":19419059,"node_id":"MDQ6VXNlcjE5NDE5MDU5","avatar_url":"https://avatars2.githubusercontent.com/u/19419059?v=4","gravatar_id":"","url":"https://api.github.com/users/jasmaa","html_url":"https://github.com/jasmaa","followers_url":"https://api.github.com/users/jasmaa/followers","following_url":"https://api.github.com/users/jasmaa/following{/other_user}","gists_url":"https://api.github.com/users/jasmaa/gists{/gist_id}","starred_url":"https://api.github.com/users/jasmaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasmaa/subscriptions","organizations_url":"https://api.github.com/users/jasmaa/orgs","repos_url":"https://api.github.com/users/jasmaa/repos","events_url":"https://api.github.com/users/jasmaa/events{/privacy}","received_events_url":"https://api.github.com/users/jasmaa/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jasmaa/algorithm-archive","description":"A collaborative book on algorithms","fork":true,"url":"https://api.github.com/repos/jasmaa/algorithm-archive","forks_url":"https://api.github.com/repos/jasmaa/algorithm-archive/forks","keys_url":"https://api.github.com/repos/jasmaa/algorithm-archive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jasmaa/algorithm-archive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jasmaa/algorithm-archive/teams","hooks_url":"https://api.github.com/repos/jasmaa/algorithm-archive/hooks","issue_events_url":"https://api.github.com/repos/jasmaa/algorithm-archive/issues/events{/number}","events_url":"https://api.github.com/repos/jasmaa/algorithm-archive/events","assignees_url":"https://api.github.com/repos/jasmaa/algorithm-archive/assignees{/user}","branches_url":"https://api.github.com/repos/jasmaa/algorithm-archive/branches{/branch}","tags_url":"https://api.github.com/repos/jasmaa/algorithm-archive/tags","blobs_url":"https://api.github.com/repos/jasmaa/algorithm-archive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jasmaa/algorithm-archive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jasmaa/algorithm-archive/git/refs{/sha}","trees_url":"https://api.github.com/repos/jasmaa/algorithm-archive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jasmaa/algorithm-archive/statuses/{sha}","languages_url":"https://api.github.com/repos/jasmaa/algorithm-archive/languages","stargazers_url":"https://api.github.com/repos/jasmaa/algorithm-archive/stargazers","contributors_url":"https://api.github.com/repos/jasmaa/algorithm-archive/contributors","subscribers_url":"https://api.github.com/repos/jasmaa/algorithm-archive/subscribers","subscription_url":"https://api.github.com/repos/jasmaa/algorithm-archive/subscription","commits_url":"https://api.github.com/repos/jasmaa/algorithm-archive/commits{/sha}","git_commits_url":"https://api.github.com/repos/jasmaa/algorithm-archive/git/commits{/sha}","comments_url":"https://api.github.com/repos/jasmaa/algorithm-archive/comments{/number}","issue_comment_url":"https://api.github.com/repos/jasmaa/algorithm-archive/issues/comments{/number}","contents_url":"https://api.github.com/repos/jasmaa/algorithm-archive/contents/{+path}","compare_url":"https://api.github.com/repos/jasmaa/algorithm-archive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jasmaa/algorithm-archive/merges","archive_url":"https://api.github.com/repos/jasmaa/algorithm-archive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jasmaa/algorithm-archive/downloads","issues_url":"https://api.github.com/repos/jasmaa/algorithm-archive/issues{/number}","pulls_url":"https://api.github.com/repos/jasmaa/algorithm-archive/pulls{/number}","milestones_url":"https://api.github.com/repos/jasmaa/algorithm-archive/milestones{/number}","notifications_url":"https://api.github.com/repos/jasmaa/algorithm-archive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jasmaa/algorithm-archive/labels{/name}","releases_url":"https://api.github.com/repos/jasmaa/algorithm-archive/releases{/id}","deployments_url":"https://api.github.com/repos/jasmaa/algorithm-archive/deployments","created_at":"2018-08-24T12:02:01Z","updated_at":"2018-10-01T15:20:32Z","pushed_at":"2018-10-01T18:00:18Z","git_url":"git://github.com/jasmaa/algorithm-archive.git","ssh_url":"git@github.com:jasmaa/algorithm-archive.git","clone_url":"https://github.com/jasmaa/algorithm-archive.git","svn_url":"https://github.com/jasmaa/algorithm-archive","homepage":"https://www.algorithm-archive.org","size":8728,"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,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"algorithm-archivists:master","ref":"master","sha":"44181dc533101507167ae8fe2c97329100941098","user":{"login":"algorithm-archivists","id":38796691,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4Nzk2Njkx","avatar_url":"https://avatars2.githubusercontent.com/u/38796691?v=4","gravatar_id":"","url":"https://api.github.com/users/algorithm-archivists","html_url":"https://github.com/algorithm-archivists","followers_url":"https://api.github.com/users/algorithm-archivists/followers","following_url":"https://api.github.com/users/algorithm-archivists/following{/other_user}","gists_url":"https://api.github.com/users/algorithm-archivists/gists{/gist_id}","starred_url":"https://api.github.com/users/algorithm-archivists/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/algorithm-archivists/subscriptions","organizations_url":"https://api.github.com/users/algorithm-archivists/orgs","repos_url":"https://api.github.com/users/algorithm-archivists/repos","events_url":"https://api.github.com/users/algorithm-archivists/events{/privacy}","received_events_url":"https://api.github.com/users/algorithm-archivists/received_events","type":"Organization","site_admin":false},"repo":{"id":81649789,"node_id":"MDEwOlJlcG9zaXRvcnk4MTY0OTc4OQ==","name":"algorithm-archive","full_name":"algorithm-archivists/algorithm-archive","private":false,"owner":{"login":"algorithm-archivists","id":38796691,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4Nzk2Njkx","avatar_url":"https://avatars2.githubusercontent.com/u/38796691?v=4","gravatar_id":"","url":"https://api.github.com/users/algorithm-archivists","html_url":"https://github.com/algorithm-archivists","followers_url":"https://api.github.com/users/algorithm-archivists/followers","following_url":"https://api.github.com/users/algorithm-archivists/following{/other_user}","gists_url":"https://api.github.com/users/algorithm-archivists/gists{/gist_id}","starred_url":"https://api.github.com/users/algorithm-archivists/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/algorithm-archivists/subscriptions","organizations_url":"https://api.github.com/users/algorithm-archivists/orgs","repos_url":"https://api.github.com/users/algorithm-archivists/repos","events_url":"https://api.github.com/users/algorithm-archivists/events{/privacy}","received_events_url":"https://api.github.com/users/algorithm-archivists/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/algorithm-archivists/algorithm-archive","description":"A collaborative book on algorithms","fork":false,"url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive","forks_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/forks","keys_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/teams","hooks_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/hooks","issue_events_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues/events{/number}","events_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/events","assignees_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/assignees{/user}","branches_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/branches{/branch}","tags_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/tags","blobs_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/git/refs{/sha}","trees_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/statuses/{sha}","languages_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/languages","stargazers_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/stargazers","contributors_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/contributors","subscribers_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/subscribers","subscription_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/subscription","commits_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/commits{/sha}","git_commits_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/git/commits{/sha}","comments_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/comments{/number}","issue_comment_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues/comments{/number}","contents_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/contents/{+path}","compare_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/merges","archive_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/downloads","issues_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues{/number}","pulls_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls{/number}","milestones_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/milestones{/number}","notifications_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/labels{/name}","releases_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/releases{/id}","deployments_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/deployments","created_at":"2017-02-11T11:52:40Z","updated_at":"2018-10-02T02:56:04Z","pushed_at":"2018-10-02T04:37:47Z","git_url":"git://github.com/algorithm-archivists/algorithm-archive.git","ssh_url":"git@github.com:algorithm-archivists/algorithm-archive.git","clone_url":"https://github.com/algorithm-archivists/algorithm-archive.git","svn_url":"https://github.com/algorithm-archivists/algorithm-archive","homepage":"https://www.algorithm-archive.org","size":8726,"stargazers_count":608,"watchers_count":608,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":151,"mirror_url":null,"archived":false,"open_issues_count":51,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":151,"open_issues":51,"watchers":608,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/408"},"html":{"href":"https://github.com/algorithm-archivists/algorithm-archive/pull/408"},"issue":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues/408"},"comments":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues/408/comments"},"review_comments":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/408/comments"},"review_comment":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/408/commits"},"statuses":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/statuses/d92856964c3609bfc8241a9c78574825d50eb0f0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jiegillet"}}