{"action":"created","comment":{"url":"https://api.github.com/repos/blaze/dask/pulls/comments/49985071","id":49985071,"diff_hunk":"@@ -328,3 +329,98 @@ def svd(a, name=None):\n     dask.array.linalg.tsqr: Actual implementation with citation\n     \"\"\"\n     return tsqr(a, name, compute_svd=True)\n+\n+\n+def lu(a):\n+    import scipy.linalg\n+\n+    if a.ndim != 2:\n+        raise ValueError('dimension must be 2 to perform lu decomposition')\n+\n+    xdim, ydim = a.shape\n+    if xdim != ydim:\n+        raise ValueError('input must be a square matrix to perform lu decomposition')\n+    if not len(set(a.chunks[0] + a.chunks[1])) == 1:\n+        raise ValueError('all chunks must be a square matrix to perform lu decomposition')","path":"dask/array/linalg.py","position":null,"original_position":24,"commit_id":"e6bf853d6e4c76455d92fcc0b74da02beb97a8d1","original_commit_id":"12fddb43d1b9c3b7037d70ffb03127dce2a51189","user":{"login":"sinhrks","id":1696302,"avatar_url":"https://avatars.githubusercontent.com/u/1696302?v=3","gravatar_id":"","url":"https://api.github.com/users/sinhrks","html_url":"https://github.com/sinhrks","followers_url":"https://api.github.com/users/sinhrks/followers","following_url":"https://api.github.com/users/sinhrks/following{/other_user}","gists_url":"https://api.github.com/users/sinhrks/gists{/gist_id}","starred_url":"https://api.github.com/users/sinhrks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinhrks/subscriptions","organizations_url":"https://api.github.com/users/sinhrks/orgs","repos_url":"https://api.github.com/users/sinhrks/repos","events_url":"https://api.github.com/users/sinhrks/events{/privacy}","received_events_url":"https://api.github.com/users/sinhrks/received_events","type":"User","site_admin":false},"body":"OK, updated the error mesagge to indicate ``rechunk``.","created_at":"2016-01-18T10:57:15Z","updated_at":"2016-01-18T10:57:15Z","html_url":"https://github.com/blaze/dask/pull/885#discussion_r49985071","pull_request_url":"https://api.github.com/repos/blaze/dask/pulls/885","_links":{"self":{"href":"https://api.github.com/repos/blaze/dask/pulls/comments/49985071"},"html":{"href":"https://github.com/blaze/dask/pull/885#discussion_r49985071"},"pull_request":{"href":"https://api.github.com/repos/blaze/dask/pulls/885"}}},"pull_request":{"url":"https://api.github.com/repos/blaze/dask/pulls/885","id":54095075,"html_url":"https://github.com/blaze/dask/pull/885","diff_url":"https://github.com/blaze/dask/pull/885.diff","patch_url":"https://github.com/blaze/dask/pull/885.patch","issue_url":"https://api.github.com/repos/blaze/dask/issues/885","number":885,"state":"open","locked":false,"title":"ENH: Add LU decomposition","user":{"login":"sinhrks","id":1696302,"avatar_url":"https://avatars.githubusercontent.com/u/1696302?v=3","gravatar_id":"","url":"https://api.github.com/users/sinhrks","html_url":"https://github.com/sinhrks","followers_url":"https://api.github.com/users/sinhrks/followers","following_url":"https://api.github.com/users/sinhrks/following{/other_user}","gists_url":"https://api.github.com/users/sinhrks/gists{/gist_id}","starred_url":"https://api.github.com/users/sinhrks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinhrks/subscriptions","organizations_url":"https://api.github.com/users/sinhrks/orgs","repos_url":"https://api.github.com/users/sinhrks/repos","events_url":"https://api.github.com/users/sinhrks/events{/privacy}","received_events_url":"https://api.github.com/users/sinhrks/received_events","type":"User","site_admin":false},"body":"It is still under work. I'm going to built ``scipy.linalg.lu`` compat API using blocked gaussian elimination.\r\n\r\n```\r\nA = np.array([[7, 3, -1, 2], [3, 8, 1, -4], [-1, 1, 4, -1], [2, -4, -1, 6] ])\r\nA\r\n# array([[ 7,  3, -1,  2],\r\n#        [ 3,  8,  1, -4],\r\n#        [-1,  1,  4, -1],\r\n#        [ 2, -4, -1,  6]])\r\n\r\ndA = da.from_array(A, chunks=(2, 2))\r\ndA\r\n# dask.array<from-ar..., shape=(4, 4), dtype=int64, chunksize=(2, 2)>\r\n\r\np, l, u = da.linalg.lu(dA)\r\nl\r\n# dask.array<lu-l-6d..., shape=(4, 4), dtype=int64, chunksize=(2, 2)>\r\n\r\np.compute()\r\n# array([[ 1.,  0.,  0.,  0.],\r\n#        [ 0.,  1.,  0.,  0.],\r\n#        [ 0.,  0.,  1.,  0.],\r\n#        [ 0.,  0.,  0.,  1.]])\r\n\r\nl.compute()\r\n# array([[ 1.        ,  0.        ,  0.        ,  0.        ],\r\n#        [ 0.42857143,  1.        ,  0.        ,  0.        ],\r\n#        [-0.14285714,  0.21276596,  1.        ,  0.        ],\r\n#        [ 0.28571429, -0.72340426,  0.08982036,  1.        ]])\r\n\r\nu.compute()\r\n# array([[ 7.        ,  3.        , -1.        ,  2.        ],\r\n#        [ 0.        ,  6.71428571,  1.42857143, -4.85714286],\r\n#        [ 0.        ,  0.        ,  3.55319149,  0.31914894],\r\n#        [ 0.        ,  0.        ,  0.        ,  1.88622754]])\r\n```\r\n\r\n## scipy results\r\n\r\n```\r\np, l, u = scipy.linalg.lu(A)\r\np\r\n# array([[ 1.,  0.,  0.,  0.],\r\n#        [ 0.,  1.,  0.,  0.],\r\n#        [ 0.,  0.,  1.,  0.],\r\n#        [ 0.,  0.,  0.,  1.]])\r\n\r\nl\r\n# array([[ 1.        ,  0.        ,  0.        ,  0.        ],\r\n#        [ 0.42857143,  1.        ,  0.        ,  0.        ],\r\n#        [-0.14285714,  0.21276596,  1.        ,  0.        ],\r\n#        [ 0.28571429, -0.72340426,  0.08982036,  1.        ]])\r\n\r\nu\r\n# array([[ 7.        ,  3.        , -1.        ,  2.        ],\r\n#        [ 0.        ,  6.71428571,  1.42857143, -4.85714286],\r\n#        [ 0.        ,  0.        ,  3.55319149,  0.31914894],\r\n#        [ 0.        ,  0.        ,  0.        ,  1.88622754]])\r\n```\r\n","created_at":"2015-12-18T12:00:04Z","updated_at":"2016-01-18T10:57:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c96f1e34f1a531b45ed49bbee9bf00a7ce658bd2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/blaze/dask/pulls/885/commits","review_comments_url":"https://api.github.com/repos/blaze/dask/pulls/885/comments","review_comment_url":"https://api.github.com/repos/blaze/dask/pulls/comments{/number}","comments_url":"https://api.github.com/repos/blaze/dask/issues/885/comments","statuses_url":"https://api.github.com/repos/blaze/dask/statuses/e6bf853d6e4c76455d92fcc0b74da02beb97a8d1","head":{"label":"sinhrks:lu","ref":"lu","sha":"e6bf853d6e4c76455d92fcc0b74da02beb97a8d1","user":{"login":"sinhrks","id":1696302,"avatar_url":"https://avatars.githubusercontent.com/u/1696302?v=3","gravatar_id":"","url":"https://api.github.com/users/sinhrks","html_url":"https://github.com/sinhrks","followers_url":"https://api.github.com/users/sinhrks/followers","following_url":"https://api.github.com/users/sinhrks/following{/other_user}","gists_url":"https://api.github.com/users/sinhrks/gists{/gist_id}","starred_url":"https://api.github.com/users/sinhrks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinhrks/subscriptions","organizations_url":"https://api.github.com/users/sinhrks/orgs","repos_url":"https://api.github.com/users/sinhrks/repos","events_url":"https://api.github.com/users/sinhrks/events{/privacy}","received_events_url":"https://api.github.com/users/sinhrks/received_events","type":"User","site_admin":false},"repo":{"id":38960014,"name":"dask","full_name":"sinhrks/dask","owner":{"login":"sinhrks","id":1696302,"avatar_url":"https://avatars.githubusercontent.com/u/1696302?v=3","gravatar_id":"","url":"https://api.github.com/users/sinhrks","html_url":"https://github.com/sinhrks","followers_url":"https://api.github.com/users/sinhrks/followers","following_url":"https://api.github.com/users/sinhrks/following{/other_user}","gists_url":"https://api.github.com/users/sinhrks/gists{/gist_id}","starred_url":"https://api.github.com/users/sinhrks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinhrks/subscriptions","organizations_url":"https://api.github.com/users/sinhrks/orgs","repos_url":"https://api.github.com/users/sinhrks/repos","events_url":"https://api.github.com/users/sinhrks/events{/privacy}","received_events_url":"https://api.github.com/users/sinhrks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sinhrks/dask","description":"Task scheduling and blocked algorithms for parallel processing","fork":true,"url":"https://api.github.com/repos/sinhrks/dask","forks_url":"https://api.github.com/repos/sinhrks/dask/forks","keys_url":"https://api.github.com/repos/sinhrks/dask/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sinhrks/dask/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sinhrks/dask/teams","hooks_url":"https://api.github.com/repos/sinhrks/dask/hooks","issue_events_url":"https://api.github.com/repos/sinhrks/dask/issues/events{/number}","events_url":"https://api.github.com/repos/sinhrks/dask/events","assignees_url":"https://api.github.com/repos/sinhrks/dask/assignees{/user}","branches_url":"https://api.github.com/repos/sinhrks/dask/branches{/branch}","tags_url":"https://api.github.com/repos/sinhrks/dask/tags","blobs_url":"https://api.github.com/repos/sinhrks/dask/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sinhrks/dask/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sinhrks/dask/git/refs{/sha}","trees_url":"https://api.github.com/repos/sinhrks/dask/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sinhrks/dask/statuses/{sha}","languages_url":"https://api.github.com/repos/sinhrks/dask/languages","stargazers_url":"https://api.github.com/repos/sinhrks/dask/stargazers","contributors_url":"https://api.github.com/repos/sinhrks/dask/contributors","subscribers_url":"https://api.github.com/repos/sinhrks/dask/subscribers","subscription_url":"https://api.github.com/repos/sinhrks/dask/subscription","commits_url":"https://api.github.com/repos/sinhrks/dask/commits{/sha}","git_commits_url":"https://api.github.com/repos/sinhrks/dask/git/commits{/sha}","comments_url":"https://api.github.com/repos/sinhrks/dask/comments{/number}","issue_comment_url":"https://api.github.com/repos/sinhrks/dask/issues/comments{/number}","contents_url":"https://api.github.com/repos/sinhrks/dask/contents/{+path}","compare_url":"https://api.github.com/repos/sinhrks/dask/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sinhrks/dask/merges","archive_url":"https://api.github.com/repos/sinhrks/dask/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sinhrks/dask/downloads","issues_url":"https://api.github.com/repos/sinhrks/dask/issues{/number}","pulls_url":"https://api.github.com/repos/sinhrks/dask/pulls{/number}","milestones_url":"https://api.github.com/repos/sinhrks/dask/milestones{/number}","notifications_url":"https://api.github.com/repos/sinhrks/dask/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sinhrks/dask/labels{/name}","releases_url":"https://api.github.com/repos/sinhrks/dask/releases{/id}","created_at":"2015-07-12T11:42:08Z","updated_at":"2015-07-12T11:42:08Z","pushed_at":"2016-01-18T10:55:17Z","git_url":"git://github.com/sinhrks/dask.git","ssh_url":"git@github.com:sinhrks/dask.git","clone_url":"https://github.com/sinhrks/dask.git","svn_url":"https://github.com/sinhrks/dask","homepage":"http://dask.pydata.org","size":8977,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"blaze:master","ref":"master","sha":"1b3cf04968b2cc5b0bdbc85858fb32c9446fd669","user":{"login":"blaze","id":12833921,"avatar_url":"https://avatars.githubusercontent.com/u/12833921?v=3","gravatar_id":"","url":"https://api.github.com/users/blaze","html_url":"https://github.com/blaze","followers_url":"https://api.github.com/users/blaze/followers","following_url":"https://api.github.com/users/blaze/following{/other_user}","gists_url":"https://api.github.com/users/blaze/gists{/gist_id}","starred_url":"https://api.github.com/users/blaze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blaze/subscriptions","organizations_url":"https://api.github.com/users/blaze/orgs","repos_url":"https://api.github.com/users/blaze/repos","events_url":"https://api.github.com/users/blaze/events{/privacy}","received_events_url":"https://api.github.com/users/blaze/received_events","type":"Organization","site_admin":false},"repo":{"id":28782747,"name":"dask","full_name":"blaze/dask","owner":{"login":"blaze","id":12833921,"avatar_url":"https://avatars.githubusercontent.com/u/12833921?v=3","gravatar_id":"","url":"https://api.github.com/users/blaze","html_url":"https://github.com/blaze","followers_url":"https://api.github.com/users/blaze/followers","following_url":"https://api.github.com/users/blaze/following{/other_user}","gists_url":"https://api.github.com/users/blaze/gists{/gist_id}","starred_url":"https://api.github.com/users/blaze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blaze/subscriptions","organizations_url":"https://api.github.com/users/blaze/orgs","repos_url":"https://api.github.com/users/blaze/repos","events_url":"https://api.github.com/users/blaze/events{/privacy}","received_events_url":"https://api.github.com/users/blaze/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/blaze/dask","description":"Task scheduling and blocked algorithms for parallel processing","fork":false,"url":"https://api.github.com/repos/blaze/dask","forks_url":"https://api.github.com/repos/blaze/dask/forks","keys_url":"https://api.github.com/repos/blaze/dask/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blaze/dask/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blaze/dask/teams","hooks_url":"https://api.github.com/repos/blaze/dask/hooks","issue_events_url":"https://api.github.com/repos/blaze/dask/issues/events{/number}","events_url":"https://api.github.com/repos/blaze/dask/events","assignees_url":"https://api.github.com/repos/blaze/dask/assignees{/user}","branches_url":"https://api.github.com/repos/blaze/dask/branches{/branch}","tags_url":"https://api.github.com/repos/blaze/dask/tags","blobs_url":"https://api.github.com/repos/blaze/dask/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blaze/dask/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blaze/dask/git/refs{/sha}","trees_url":"https://api.github.com/repos/blaze/dask/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blaze/dask/statuses/{sha}","languages_url":"https://api.github.com/repos/blaze/dask/languages","stargazers_url":"https://api.github.com/repos/blaze/dask/stargazers","contributors_url":"https://api.github.com/repos/blaze/dask/contributors","subscribers_url":"https://api.github.com/repos/blaze/dask/subscribers","subscription_url":"https://api.github.com/repos/blaze/dask/subscription","commits_url":"https://api.github.com/repos/blaze/dask/commits{/sha}","git_commits_url":"https://api.github.com/repos/blaze/dask/git/commits{/sha}","comments_url":"https://api.github.com/repos/blaze/dask/comments{/number}","issue_comment_url":"https://api.github.com/repos/blaze/dask/issues/comments{/number}","contents_url":"https://api.github.com/repos/blaze/dask/contents/{+path}","compare_url":"https://api.github.com/repos/blaze/dask/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blaze/dask/merges","archive_url":"https://api.github.com/repos/blaze/dask/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blaze/dask/downloads","issues_url":"https://api.github.com/repos/blaze/dask/issues{/number}","pulls_url":"https://api.github.com/repos/blaze/dask/pulls{/number}","milestones_url":"https://api.github.com/repos/blaze/dask/milestones{/number}","notifications_url":"https://api.github.com/repos/blaze/dask/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blaze/dask/labels{/name}","releases_url":"https://api.github.com/repos/blaze/dask/releases{/id}","created_at":"2015-01-04T18:50:00Z","updated_at":"2016-01-15T18:11:26Z","pushed_at":"2016-01-18T10:55:17Z","git_url":"git://github.com/blaze/dask.git","ssh_url":"git@github.com:blaze/dask.git","clone_url":"https://github.com/blaze/dask.git","svn_url":"https://github.com/blaze/dask","homepage":"http://dask.pydata.org","size":9915,"stargazers_count":485,"watchers_count":485,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":82,"mirror_url":null,"open_issues_count":85,"forks":82,"open_issues":85,"watchers":485,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/blaze/dask/pulls/885"},"html":{"href":"https://github.com/blaze/dask/pull/885"},"issue":{"href":"https://api.github.com/repos/blaze/dask/issues/885"},"comments":{"href":"https://api.github.com/repos/blaze/dask/issues/885/comments"},"review_comments":{"href":"https://api.github.com/repos/blaze/dask/pulls/885/comments"},"review_comment":{"href":"https://api.github.com/repos/blaze/dask/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/blaze/dask/pulls/885/commits"},"statuses":{"href":"https://api.github.com/repos/blaze/dask/statuses/e6bf853d6e4c76455d92fcc0b74da02beb97a8d1"}}}}