{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/36939650","id":36939650,"diff_hunk":"@@ -149,65 +149,77 @@ istril(A::UnitLowerTriangular) = true\n istriu(A::UpperTriangular) = true\n istriu(A::UnitUpperTriangular) = true\n \n-function tril(A::UpperTriangular,k::Integer=0)\n+function tril!(A::UpperTriangular,k::Integer=0)\n     n = size(A,1)\n     if abs(k) > n\n         throw(ArgumentError(\"requested diagonal, $k, out of bounds in matrix of size ($n,$n)\"))\n     elseif k < 0\n-        return UpperTriangular(zeros(A.data))\n+        fill!(A.data,0)\n+        return A\n     elseif k == 0\n         return UpperTriangular(diagm(diag(A)))\n     else\n-        return UpperTriangular(triu(tril(A.data,k)))\n+        return UpperTriangular(triu!(tril!(A.data,k)))\n     end\n end\n+triu!(A::UpperTriangular,k::Integer=0) = UpperTriangular(triu!(triu!(A.data),k))\n \n-triu(A::UpperTriangular,k::Integer=0) = UpperTriangular(triu(triu(A.data),k))\n-\n-function tril(A::UnitUpperTriangular,k::Integer=0)\n+function tril!(A::UnitUpperTriangular,k::Integer=0)\n     n = size(A,1)\n     if abs(k) > n\n         throw(ArgumentError(\"requested diagonal, $k, out of bounds in matrix of size ($n,$n)\"))\n     elseif k < 0\n-        return UnitUpperTriangular(zeros(A.data))\n+        fill!(A.data,0)\n+        return UpperTriangular(A.data)\n     elseif k == 0\n         return UnitUpperTriangular(eye(A))\n     else\n-        return UnitUpperTriangular(triu(tril(A.data,k)))\n+        return UnitUpperTriangular(triu!(tril!(A.data,k)))\n     end\n end\n \n-triu(A::UnitUpperTriangular,k::Integer=0) = UnitUpperTriangular(triu(triu(A.data),k))\n+triu!(A::UnitUpperTriangular,k::Integer=0) = UnitUpperTriangular(triu!(triu!(A.data),k))\n \n-function triu(A::LowerTriangular,k::Integer=0)\n+function triu!(A::LowerTriangular,k::Integer=0)\n     n = size(A,1)\n     if abs(k) > n\n         throw(ArgumentError(\"requested diagonal, $k, out of bounds in matrix of size ($n,$n)\"))\n     elseif k > 0\n-        return LowerTriangular(zeros(A.data))\n+        fill!(A.data,0)\n+        return A\n     elseif k == 0\n         return LowerTriangular(diagm(diag(A)))\n     else\n-        return LowerTriangular(tril(triu(A.data,k)))\n+        return LowerTriangular(tril!(triu!(A.data,k)))\n     end\n end\n \n-tril(A::LowerTriangular,k::Integer=0) = LowerTriangular(tril(tril(A.data),k))\n+tril!(A::LowerTriangular,k::Integer=0) = LowerTriangular(tril!(tril!(A.data),k))\n \n-function triu(A::UnitLowerTriangular,k::Integer=0)\n+function triu!(A::UnitLowerTriangular,k::Integer=0)\n     n = size(A,1)\n     if abs(k) > n\n         throw(ArgumentError(\"requested diagonal, $k, out of bounds in matrix of size ($n,$n)\"))\n     elseif k > 0\n-        return UnitLowerTriangular(zeros(A.data))\n+        fill!(A.data,0)\n+        return LowerTriangular(A.data)\n     elseif k == 0\n         return UnitLowerTriangular(eye(A))\n     else\n-        return UnitLowerTriangular(tril(triu(A.data,k)))\n+        return UnitLowerTriangular(tril!(triu!(A.data,k)))\n     end\n end\n \n-tril(A::UnitLowerTriangular,k::Integer=0) = UnitLowerTriangular(tril(tril(A.data),k))\n+tril!(A::UnitLowerTriangular,k::Integer=0) = UnitLowerTriangular(tril!(tril!(A.data),k))\n+\n+tril(A::UpperTriangular,k::Integer=0)     = tril!(copy(A),k)","path":"base/linalg/triangular.jl","position":84,"original_position":84,"commit_id":"4514ac85761462918f4ccb7c777e4d39c87edef8","original_commit_id":"4514ac85761462918f4ccb7c777e4d39c87edef8","user":{"login":"tkelman","id":5934628,"avatar_url":"https://avatars.githubusercontent.com/u/5934628?v=3","gravatar_id":"","url":"https://api.github.com/users/tkelman","html_url":"https://github.com/tkelman","followers_url":"https://api.github.com/users/tkelman/followers","following_url":"https://api.github.com/users/tkelman/following{/other_user}","gists_url":"https://api.github.com/users/tkelman/gists{/gist_id}","starred_url":"https://api.github.com/users/tkelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkelman/subscriptions","organizations_url":"https://api.github.com/users/tkelman/orgs","repos_url":"https://api.github.com/users/tkelman/repos","events_url":"https://api.github.com/users/tkelman/events{/privacy}","received_events_url":"https://api.github.com/users/tkelman/received_events","type":"User","site_admin":false},"body":"should the generic fallbacks here https://github.com/JuliaLang/julia/blob/24a92a9f5df149b5a58ad1c4758de87599f5a9ac/base/linalg/generic.jl#L41-L44\r\nbe tweaked to cover all of these?","created_at":"2015-08-13T04:09:56Z","updated_at":"2015-08-13T04:09:56Z","html_url":"https://github.com/JuliaLang/julia/pull/12594#discussion_r36939650","pull_request_url":"https://api.github.com/repos/JuliaLang/julia/pulls/12594","_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/36939650"},"html":{"href":"https://github.com/JuliaLang/julia/pull/12594#discussion_r36939650"},"pull_request":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/12594"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/12594","id":42306158,"html_url":"https://github.com/JuliaLang/julia/pull/12594","diff_url":"https://github.com/JuliaLang/julia/pull/12594.diff","patch_url":"https://github.com/JuliaLang/julia/pull/12594.patch","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/12594","number":12594,"state":"open","locked":false,"title":"Address type stability issues in #12574 and fix a bug or two","user":{"login":"kshyatt","id":828643,"avatar_url":"https://avatars.githubusercontent.com/u/828643?v=3","gravatar_id":"","url":"https://api.github.com/users/kshyatt","html_url":"https://github.com/kshyatt","followers_url":"https://api.github.com/users/kshyatt/followers","following_url":"https://api.github.com/users/kshyatt/following{/other_user}","gists_url":"https://api.github.com/users/kshyatt/gists{/gist_id}","starred_url":"https://api.github.com/users/kshyatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshyatt/subscriptions","organizations_url":"https://api.github.com/users/kshyatt/orgs","repos_url":"https://api.github.com/users/kshyatt/repos","events_url":"https://api.github.com/users/kshyatt/events{/privacy}","received_events_url":"https://api.github.com/users/kshyatt/received_events","type":"User","site_admin":false},"body":"The `trix` methods should have been `trix!` since they return references. The methods for `Unit{Upper/Lower]Triangular` matrices were wrong (now fixed) and I also caught a bug in `istriu/istril` for `Tridiagonal`s.\r\n\r\ncc: @andreasnoack and @tkelman ","created_at":"2015-08-13T01:03:45Z","updated_at":"2015-08-13T04:09:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"775283253b93ef46d982f02f9596ef8dfd4470d6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaLang/julia/pulls/12594/commits","review_comments_url":"https://api.github.com/repos/JuliaLang/julia/pulls/12594/comments","review_comment_url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/12594/comments","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/4514ac85761462918f4ccb7c777e4d39c87edef8","head":{"label":"JuliaLang:ksh/fixtrix","ref":"ksh/fixtrix","sha":"4514ac85761462918f4ccb7c777e4d39c87edef8","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":1644196,"name":"julia","full_name":"JuliaLang/julia","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","created_at":"2011-04-21T07:01:50Z","updated_at":"2015-08-12T20:20:34Z","pushed_at":"2015-08-13T04:04:33Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"http://julialang.org/","size":211591,"stargazers_count":5857,"watchers_count":5857,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1263,"mirror_url":null,"open_issues_count":1297,"forks":1263,"open_issues":1297,"watchers":5857,"default_branch":"master"}},"base":{"label":"JuliaLang:master","ref":"master","sha":"24a92a9f5df149b5a58ad1c4758de87599f5a9ac","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":1644196,"name":"julia","full_name":"JuliaLang/julia","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","created_at":"2011-04-21T07:01:50Z","updated_at":"2015-08-12T20:20:34Z","pushed_at":"2015-08-13T04:04:33Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"http://julialang.org/","size":211591,"stargazers_count":5857,"watchers_count":5857,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1263,"mirror_url":null,"open_issues_count":1297,"forks":1263,"open_issues":1297,"watchers":5857,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/12594"},"html":{"href":"https://github.com/JuliaLang/julia/pull/12594"},"issue":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/12594"},"comments":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/12594/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/12594/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/12594/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaLang/julia/statuses/4514ac85761462918f4ccb7c777e4d39c87edef8"}}}}