{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/13008","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/13008/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/13008/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/13008/events","html_url":"https://github.com/JuliaLang/julia/issues/13008","id":105277067,"number":13008,"title":"Should sparse(i,j,v,m,n) always truncate input to an mxn matrix?","user":{"login":"sbromberger","id":941359,"avatar_url":"https://avatars.githubusercontent.com/u/941359?v=3","gravatar_id":"","url":"https://api.github.com/users/sbromberger","html_url":"https://github.com/sbromberger","followers_url":"https://api.github.com/users/sbromberger/followers","following_url":"https://api.github.com/users/sbromberger/following{/other_user}","gists_url":"https://api.github.com/users/sbromberger/gists{/gist_id}","starred_url":"https://api.github.com/users/sbromberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbromberger/subscriptions","organizations_url":"https://api.github.com/users/sbromberger/orgs","repos_url":"https://api.github.com/users/sbromberger/repos","events_url":"https://api.github.com/users/sbromberger/events{/privacy}","received_events_url":"https://api.github.com/users/sbromberger/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/error%20handling","name":"error handling","color":"02d7e1"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/sparse","name":"sparse","color":"fad8c7"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/speculative","name":"speculative","color":"999999"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-09-07T23:35:40Z","updated_at":"2015-09-08T00:44:32Z","closed_at":null,"body":"Right now,\r\n```\r\njulia> i = [1:100;]; j = [1:100;]; v = fill(5,100); m = 5; n = 5\r\n5\r\n\r\njulia> sparse(i,j,v,m,n)\r\nERROR: BoundsError: attempt to access 6-element Array{Int64,1}:\r\n 1\r\n 1\r\n 1\r\n 1\r\n 1\r\n 1\r\n  at index [7]\r\n in sparse at sparse/csparse.jl:35\r\n in sparse at sparse/sparsematrix.jl:320\r\n```\r\n\r\nMuch better would be to create\r\n```\r\n5x5 sparse matrix with 5 Int64 entries:\r\n\t[1, 1]  =  5\r\n\t[2, 2]  =  5\r\n\t[3, 3]  =  5\r\n\t[4, 4]  =  5\r\n\t[5, 5]  =  5\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/138399099","html_url":"https://github.com/JuliaLang/julia/issues/13008#issuecomment-138399099","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/13008","id":138399099,"user":{"login":"jpfairbanks","id":2753998,"avatar_url":"https://avatars.githubusercontent.com/u/2753998?v=3","gravatar_id":"","url":"https://api.github.com/users/jpfairbanks","html_url":"https://github.com/jpfairbanks","followers_url":"https://api.github.com/users/jpfairbanks/followers","following_url":"https://api.github.com/users/jpfairbanks/following{/other_user}","gists_url":"https://api.github.com/users/jpfairbanks/gists{/gist_id}","starred_url":"https://api.github.com/users/jpfairbanks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpfairbanks/subscriptions","organizations_url":"https://api.github.com/users/jpfairbanks/orgs","repos_url":"https://api.github.com/users/jpfairbanks/repos","events_url":"https://api.github.com/users/jpfairbanks/events{/privacy}","received_events_url":"https://api.github.com/users/jpfairbanks/received_events","type":"User","site_admin":false},"created_at":"2015-09-08T00:44:32Z","updated_at":"2015-09-08T00:44:32Z","body":"Yeah you are growing the graph, so you need to increase the size for the m,n to be the maximum of all the values you have seen. This is similar to adding a 6x6 matrix to a 8x8 matrix. In this case what you want is an 8x8 result where you treat the 6x6 input as having 2 extra rows and columns of all zeros."}}