{"action":"created","comment":{"url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/comments/199557460","pull_request_review_id":133700124,"id":199557460,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTU1NzQ2MA==","diff_hunk":"@@ -0,0 +1,42 @@\n+#Author: gammison\n+\n+#note this example is inplace and destructive\n+def thomas(a:list,b:list,c:list,d:list):\n+    \n+    #set the initial elements\n+    c[0] = c[0] / b[0]\n+    d[0] = d[0] / b[0]\n+\n+    n = len(d) #number of equations to solve\n+    #range is exclusive, loop will run from 1 to n-1\n+    for i in range(1,n):\n+        #scale factor for c and d\n+        scale = 1 / (b[i] - c[i-1]*a[i])\n+        \n+        c[i] = c[i] * scale\n+        d[i] = (d[i] -a[i] * d[i-1]) * scale\n+\n+    \n+    #do the back substitution, will loop n-2 to 0 inclusive\n+    for i in range(n-2,-1,-1):\n+        d[i] = d[i] - c[i]*d[i+1]\n+    \n+    return d\n+    \n+    #Complexity:\n+    #Two loops,each take O(n), and a few contant time operations => T(n) = 2*O(n)+c*O(1) = O(n)\n+\n+#example for matrix\n+#[1  4  0][x]   [7]\n+#[2  3  5][y] = [5]\n+#[0  3  6][z]   [3]\n+#                [.8666]\n+#soln will equal [1.533]\n+#                [-.266]\n+#note we index a from 1 and c from 0\n+a=[0,2,3]\n+b=[1,3,6]\n+c=[4,5,0]\n+d=[7,5,3]\n+soln = thomas(a,b,c,d)\n+print(soln)","path":"chapters/matrix_methods/thomas/code/python/thomas.py","position":42,"original_position":42,"commit_id":"3563e6d80bbb830690513b25a400ebd6e25f638c","original_commit_id":"fdaef2e0506f19f6af30a21e6a57f2923650d098","user":{"login":"Butt4cak3","id":6171432,"node_id":"MDQ6VXNlcjYxNzE0MzI=","avatar_url":"https://avatars0.githubusercontent.com/u/6171432?v=4","gravatar_id":"","url":"https://api.github.com/users/Butt4cak3","html_url":"https://github.com/Butt4cak3","followers_url":"https://api.github.com/users/Butt4cak3/followers","following_url":"https://api.github.com/users/Butt4cak3/following{/other_user}","gists_url":"https://api.github.com/users/Butt4cak3/gists{/gist_id}","starred_url":"https://api.github.com/users/Butt4cak3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Butt4cak3/subscriptions","organizations_url":"https://api.github.com/users/Butt4cak3/orgs","repos_url":"https://api.github.com/users/Butt4cak3/repos","events_url":"https://api.github.com/users/Butt4cak3/events{/privacy}","received_events_url":"https://api.github.com/users/Butt4cak3/received_events","type":"User","site_admin":false},"body":"[Link for the lazy](https://github.com/algorithm-archivists/algorithm-archive/blob/a9ef5ff179c2cba47fb564cc04043da2c46c03df/chapters/data_compression/huffman/code/python/huffman.py#L93-L115)","created_at":"2018-07-02T16:45:16Z","updated_at":"2018-07-02T16:45:16Z","html_url":"https://github.com/algorithm-archivists/algorithm-archive/pull/191#discussion_r199557460","pull_request_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/191","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/comments/199557460"},"html":{"href":"https://github.com/algorithm-archivists/algorithm-archive/pull/191#discussion_r199557460"},"pull_request":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/191"}},"in_reply_to_id":199362566},"pull_request":{"url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/191","id":198505272,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4NTA1Mjcy","html_url":"https://github.com/algorithm-archivists/algorithm-archive/pull/191","diff_url":"https://github.com/algorithm-archivists/algorithm-archive/pull/191.diff","patch_url":"https://github.com/algorithm-archivists/algorithm-archive/pull/191.patch","issue_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues/191","number":191,"state":"open","locked":false,"title":"thomas python example","user":{"login":"gammison","id":6933669,"node_id":"MDQ6VXNlcjY5MzM2Njk=","avatar_url":"https://avatars2.githubusercontent.com/u/6933669?v=4","gravatar_id":"","url":"https://api.github.com/users/gammison","html_url":"https://github.com/gammison","followers_url":"https://api.github.com/users/gammison/followers","following_url":"https://api.github.com/users/gammison/following{/other_user}","gists_url":"https://api.github.com/users/gammison/gists{/gist_id}","starred_url":"https://api.github.com/users/gammison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gammison/subscriptions","organizations_url":"https://api.github.com/users/gammison/orgs","repos_url":"https://api.github.com/users/gammison/repos","events_url":"https://api.github.com/users/gammison/events{/privacy}","received_events_url":"https://api.github.com/users/gammison/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-01T03:29:06Z","updated_at":"2018-07-02T16:45:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1815dfbc1ebb4dea11271e9a376b0816e2f43b1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"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/191/commits","review_comments_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/191/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/191/comments","statuses_url":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/statuses/3563e6d80bbb830690513b25a400ebd6e25f638c","head":{"label":"gammison:tom_alg_python","ref":"tom_alg_python","sha":"3563e6d80bbb830690513b25a400ebd6e25f638c","user":{"login":"gammison","id":6933669,"node_id":"MDQ6VXNlcjY5MzM2Njk=","avatar_url":"https://avatars2.githubusercontent.com/u/6933669?v=4","gravatar_id":"","url":"https://api.github.com/users/gammison","html_url":"https://github.com/gammison","followers_url":"https://api.github.com/users/gammison/followers","following_url":"https://api.github.com/users/gammison/following{/other_user}","gists_url":"https://api.github.com/users/gammison/gists{/gist_id}","starred_url":"https://api.github.com/users/gammison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gammison/subscriptions","organizations_url":"https://api.github.com/users/gammison/orgs","repos_url":"https://api.github.com/users/gammison/repos","events_url":"https://api.github.com/users/gammison/events{/privacy}","received_events_url":"https://api.github.com/users/gammison/received_events","type":"User","site_admin":false},"repo":{"id":138970093,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg5NzAwOTM=","name":"algorithm-archive","full_name":"gammison/algorithm-archive","owner":{"login":"gammison","id":6933669,"node_id":"MDQ6VXNlcjY5MzM2Njk=","avatar_url":"https://avatars2.githubusercontent.com/u/6933669?v=4","gravatar_id":"","url":"https://api.github.com/users/gammison","html_url":"https://github.com/gammison","followers_url":"https://api.github.com/users/gammison/followers","following_url":"https://api.github.com/users/gammison/following{/other_user}","gists_url":"https://api.github.com/users/gammison/gists{/gist_id}","starred_url":"https://api.github.com/users/gammison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gammison/subscriptions","organizations_url":"https://api.github.com/users/gammison/orgs","repos_url":"https://api.github.com/users/gammison/repos","events_url":"https://api.github.com/users/gammison/events{/privacy}","received_events_url":"https://api.github.com/users/gammison/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gammison/algorithm-archive","description":"A collaborative book on algorithms","fork":true,"url":"https://api.github.com/repos/gammison/algorithm-archive","forks_url":"https://api.github.com/repos/gammison/algorithm-archive/forks","keys_url":"https://api.github.com/repos/gammison/algorithm-archive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gammison/algorithm-archive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gammison/algorithm-archive/teams","hooks_url":"https://api.github.com/repos/gammison/algorithm-archive/hooks","issue_events_url":"https://api.github.com/repos/gammison/algorithm-archive/issues/events{/number}","events_url":"https://api.github.com/repos/gammison/algorithm-archive/events","assignees_url":"https://api.github.com/repos/gammison/algorithm-archive/assignees{/user}","branches_url":"https://api.github.com/repos/gammison/algorithm-archive/branches{/branch}","tags_url":"https://api.github.com/repos/gammison/algorithm-archive/tags","blobs_url":"https://api.github.com/repos/gammison/algorithm-archive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gammison/algorithm-archive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gammison/algorithm-archive/git/refs{/sha}","trees_url":"https://api.github.com/repos/gammison/algorithm-archive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gammison/algorithm-archive/statuses/{sha}","languages_url":"https://api.github.com/repos/gammison/algorithm-archive/languages","stargazers_url":"https://api.github.com/repos/gammison/algorithm-archive/stargazers","contributors_url":"https://api.github.com/repos/gammison/algorithm-archive/contributors","subscribers_url":"https://api.github.com/repos/gammison/algorithm-archive/subscribers","subscription_url":"https://api.github.com/repos/gammison/algorithm-archive/subscription","commits_url":"https://api.github.com/repos/gammison/algorithm-archive/commits{/sha}","git_commits_url":"https://api.github.com/repos/gammison/algorithm-archive/git/commits{/sha}","comments_url":"https://api.github.com/repos/gammison/algorithm-archive/comments{/number}","issue_comment_url":"https://api.github.com/repos/gammison/algorithm-archive/issues/comments{/number}","contents_url":"https://api.github.com/repos/gammison/algorithm-archive/contents/{+path}","compare_url":"https://api.github.com/repos/gammison/algorithm-archive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gammison/algorithm-archive/merges","archive_url":"https://api.github.com/repos/gammison/algorithm-archive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gammison/algorithm-archive/downloads","issues_url":"https://api.github.com/repos/gammison/algorithm-archive/issues{/number}","pulls_url":"https://api.github.com/repos/gammison/algorithm-archive/pulls{/number}","milestones_url":"https://api.github.com/repos/gammison/algorithm-archive/milestones{/number}","notifications_url":"https://api.github.com/repos/gammison/algorithm-archive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gammison/algorithm-archive/labels{/name}","releases_url":"https://api.github.com/repos/gammison/algorithm-archive/releases{/id}","deployments_url":"https://api.github.com/repos/gammison/algorithm-archive/deployments","created_at":"2018-06-28T05:25:41Z","updated_at":"2018-06-28T05:25:44Z","pushed_at":"2018-07-01T03:48:46Z","git_url":"git://github.com/gammison/algorithm-archive.git","ssh_url":"git@github.com:gammison/algorithm-archive.git","clone_url":"https://github.com/gammison/algorithm-archive.git","svn_url":"https://github.com/gammison/algorithm-archive","homepage":"https://www.algorithm-archive.org","size":6846,"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":"8367b34c2e7b169b423104dad62a9732b7bc115e","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","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},"private":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-07-02T14:33:52Z","pushed_at":"2018-07-02T15:11:23Z","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":6855,"stargazers_count":220,"watchers_count":220,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":75,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":75,"open_issues":29,"watchers":220,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/191"},"html":{"href":"https://github.com/algorithm-archivists/algorithm-archive/pull/191"},"issue":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues/191"},"comments":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/issues/191/comments"},"review_comments":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/pulls/191/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/191/commits"},"statuses":{"href":"https://api.github.com/repos/algorithm-archivists/algorithm-archive/statuses/3563e6d80bbb830690513b25a400ebd6e25f638c"}},"author_association":"NONE"}}
{"actor":{"display_login":"Butt4cak3"}}