{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/17670","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/17670/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/17670/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/17670/events","html_url":"https://github.com/JuliaLang/julia/issues/17670","id":168155568,"number":17670,"title":"fill! behavior for structurally-constrained storage types?","user":{"login":"Sacha0","id":5799177,"avatar_url":"https://avatars.githubusercontent.com/u/5799177?v=3","gravatar_id":"","url":"https://api.github.com/users/Sacha0","html_url":"https://github.com/Sacha0","followers_url":"https://api.github.com/users/Sacha0/followers","following_url":"https://api.github.com/users/Sacha0/following{/other_user}","gists_url":"https://api.github.com/users/Sacha0/gists{/gist_id}","starred_url":"https://api.github.com/users/Sacha0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sacha0/subscriptions","organizations_url":"https://api.github.com/users/Sacha0/orgs","repos_url":"https://api.github.com/users/Sacha0/repos","events_url":"https://api.github.com/users/Sacha0/events{/privacy}","received_events_url":"https://api.github.com/users/Sacha0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-28T17:46:59Z","updated_at":"2016-07-28T18:16:57Z","closed_at":null,"body":"Ref. discussion between @martinholters and @tkelman starting at https://github.com/JuliaLang/julia/pull/16740#issuecomment-224578978. How should `fill!` behave for storage types with structural constraints such as `Bidiagonal` and `SparseMatrixCSC`? Brief illustration:\r\n```julia\r\njulia> fill!(Diagonal(rand(4)), 1) # fills within structural constraints\r\n4×4 Diagonal{Float64}:\r\n 1.0   ⋅    ⋅    ⋅\r\n  ⋅   1.0   ⋅    ⋅\r\n  ⋅    ⋅   1.0   ⋅\r\n  ⋅    ⋅    ⋅   1.0\r\n\r\njulia> fill!(Bidiagonal(rand(4), rand(3), true), 1) # fails noting structural constraints\r\nERROR: ArgumentError: Array A of type Bidiagonal{Float64} and size (4,4) can\r\n    not be filled with x=1, since some of its entries are constrained.\r\n in fill!(::Bidiagonal{Float64}, ::Int64) at ./linalg/bidiag.jl:553\r\n\r\njulia> spfoo = sprand(4, 4, 0.5)\r\n4×4 sparse matrix with 7 Float64 nonzero entries:\r\n\t[2, 1]  =  0.403982\r\n\t[3, 1]  =  0.521604\r\n\t[4, 1]  =  0.857491\r\n\t[1, 2]  =  0.318858\r\n\t[3, 3]  =  0.893084\r\n\t[2, 4]  =  0.646681\r\n\t[4, 4]  =  0.601919\r\n\r\njulia> fill!(spfoo, 1) # fills without respecting structural constraints\r\n4×4 sparse matrix with 16 Float64 nonzero entries:\r\n\t[1, 1]  =  1.0\r\n\t[2, 1]  =  1.0\r\n\t[3, 1]  =  1.0\r\n\t[4, 1]  =  1.0\r\n\t[1, 2]  =  1.0\r\n\t[2, 2]  =  1.0\r\n\t[3, 2]  =  1.0\r\n\t[4, 2]  =  1.0\r\n\t[1, 3]  =  1.0\r\n\t[2, 3]  =  1.0\r\n\t[3, 3]  =  1.0\r\n\t[4, 3]  =  1.0\r\n\t[1, 4]  =  1.0\r\n\t[2, 4]  =  1.0\r\n\t[3, 4]  =  1.0\r\n\t[4, 4]  =  1.0\r\n```\r\nIn other words, does `fill!` mean 'fill every addressable entry in the provided `AbstractArray`', or 'fill every stored entry in the provided `AbstractArray`'? Should `fill!` bifurcate into, e.g., `fillall!` and `fillstored!`? Best!"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/235979908","html_url":"https://github.com/JuliaLang/julia/issues/17670#issuecomment-235979908","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/17670","id":235979908,"user":{"login":"JaredCrean2","id":10292902,"avatar_url":"https://avatars.githubusercontent.com/u/10292902?v=3","gravatar_id":"","url":"https://api.github.com/users/JaredCrean2","html_url":"https://github.com/JaredCrean2","followers_url":"https://api.github.com/users/JaredCrean2/followers","following_url":"https://api.github.com/users/JaredCrean2/following{/other_user}","gists_url":"https://api.github.com/users/JaredCrean2/gists{/gist_id}","starred_url":"https://api.github.com/users/JaredCrean2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JaredCrean2/subscriptions","organizations_url":"https://api.github.com/users/JaredCrean2/orgs","repos_url":"https://api.github.com/users/JaredCrean2/repos","events_url":"https://api.github.com/users/JaredCrean2/events{/privacy}","received_events_url":"https://api.github.com/users/JaredCrean2/received_events","type":"User","site_admin":false},"created_at":"2016-07-28T18:16:57Z","updated_at":"2016-07-28T18:16:57Z","body":"I would reverse the convention: `fill! = fillstored!` a separate `fillall!`.  I think that leads to easier dense-sparse generalizations (at least for the class of problems I usually deal with).  Densifying a sparse matrix should be opt-in.\r\n"}}
{"actor":{"display_login":"JaredCrean2"}}