{"action":"created","issue":{"url":"https://api.github.com/repos/blaze/dask/issues/885","labels_url":"https://api.github.com/repos/blaze/dask/issues/885/labels{/name}","comments_url":"https://api.github.com/repos/blaze/dask/issues/885/comments","events_url":"https://api.github.com/repos/blaze/dask/issues/885/events","html_url":"https://github.com/blaze/dask/pull/885","id":122937219,"number":885,"title":"(WIP) 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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-12-18T12:00:04Z","updated_at":"2016-01-17T04:47:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/blaze/dask/pulls/885","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"},"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"},"comment":{"url":"https://api.github.com/repos/blaze/dask/issues/comments/172291692","html_url":"https://github.com/blaze/dask/pull/885#issuecomment-172291692","issue_url":"https://api.github.com/repos/blaze/dask/issues/885","id":172291692,"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},"created_at":"2016-01-17T04:47:45Z","updated_at":"2016-01-17T04:47:45Z","body":"Sorry to take a long. Once updated to cover more larger matrices/chunks and looks OK. Could you review?\r\n\r\n```\r\nnp.random.seed(10)\r\nA = np.random.random_integers(0, 10, (100, 100))\r\nA.shape\r\n# (100, 100)\r\n\r\nimport dask.array as da\r\ndA = da.from_array(A, chunks=(20, 20))\r\np, l, u = da.linalg.lu(dA)\r\nnp.allclose(p.dot(l.dot(u)).compute(), A)\r\n# True\r\n\r\nl.visualize()\r\n```\r\n\r\n![2016-01-17 13 46 42](https://cloud.githubusercontent.com/assets/1696302/12375994/ccc199ea-bd20-11e5-87bd-047736ad6bf3.png)"}}