{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/30121","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/30121/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/30121/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/30121/events","html_url":"https://github.com/JuliaLang/julia/issues/30121","id":383549840,"node_id":"MDU6SXNzdWUzODM1NDk4NDA=","number":30121,"title":"Odd behavior of bit/entry-wise and `.&`","user":{"login":"nangeschnappt","id":18368359,"node_id":"MDQ6VXNlcjE4MzY4MzU5","avatar_url":"https://avatars1.githubusercontent.com/u/18368359?v=4","gravatar_id":"","url":"https://api.github.com/users/nangeschnappt","html_url":"https://github.com/nangeschnappt","followers_url":"https://api.github.com/users/nangeschnappt/followers","following_url":"https://api.github.com/users/nangeschnappt/following{/other_user}","gists_url":"https://api.github.com/users/nangeschnappt/gists{/gist_id}","starred_url":"https://api.github.com/users/nangeschnappt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nangeschnappt/subscriptions","organizations_url":"https://api.github.com/users/nangeschnappt/orgs","repos_url":"https://api.github.com/users/nangeschnappt/repos","events_url":"https://api.github.com/users/nangeschnappt/events{/privacy}","received_events_url":"https://api.github.com/users/nangeschnappt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-22T14:04:47Z","updated_at":"2018-11-22T15:48:42Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"On `0.7.0`\r\n```julia\r\nusing SparseArrays\r\nm, n = 2, 2\r\nA    = ones(m, n)\r\nB    = ones(Int8, m, n)\r\nC    = sparse(1:min(m, n), 1:min(m, n), ones(Int8, min(m, n)), m, n);\r\n```\r\n```julia\r\njulia> A\r\n2×2 Array{Float64,2}:\r\n 1.0  1.0\r\n 1.0  1.0\r\n```\r\n```julia\r\njulia> B\r\n2×2 Array{Int8,2}:\r\n 1  1\r\n 1  1\r\n```\r\n```julia\r\njulia> C\r\n2×2 SparseMatrixCSC{Int8,Int64} with 2 stored entries:\r\n  [1, 1]  =  1\r\n  [2, 2]  =  1\r\n```\r\nI would expect `(A .>= 0) .& (B .& 1 .== 1) .& (C .& 1 .== 1)` to return either a `BitArray` or a `SparseMatrixCSC` of `Bool`-type (but not `Any`) entries. However,\r\n```julia\r\njulia> (A .>= 0) .& (B .& 1 .== 1) .& (C .& 1 .== 1)\r\n2×2 SparseMatrixCSC{Any,Int64} with 2 stored entries:\r\n  [1, 1]  =  true\r\n  [2, 2]  =  true\r\n```\r\nCaching each term within parentheses first\r\n```julia\r\nI_A  = A .>= 0\r\nI_B  = B .& 1 .== 1\r\nI_C  = C .& 1 .== 1\r\nI_BC = (B .& 1 .== 1) .& (C .& 1 .== 1);\r\n```\r\nwould produce\r\n```julia\r\njulia> I_A .& I_B .& I_C\r\n2×2 BitArray{2}:\r\n  true  false\r\n false   true\r\n```\r\nthat is somehow inconsistent with\r\n```julia\r\njulia> (A .>= 0) .& I_BC\r\n2×2 SparseMatrixCSC{Bool,Int64} with 2 stored entries:\r\n  [1, 1]  =  true\r\n  [2, 2]  =  true\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/441068520","html_url":"https://github.com/JuliaLang/julia/issues/30121#issuecomment-441068520","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/30121","id":441068520,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTA2ODUyMA==","user":{"login":"chethega","id":33899329,"node_id":"MDQ6VXNlcjMzODk5MzI5","avatar_url":"https://avatars2.githubusercontent.com/u/33899329?v=4","gravatar_id":"","url":"https://api.github.com/users/chethega","html_url":"https://github.com/chethega","followers_url":"https://api.github.com/users/chethega/followers","following_url":"https://api.github.com/users/chethega/following{/other_user}","gists_url":"https://api.github.com/users/chethega/gists{/gist_id}","starred_url":"https://api.github.com/users/chethega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chethega/subscriptions","organizations_url":"https://api.github.com/users/chethega/orgs","repos_url":"https://api.github.com/users/chethega/repos","events_url":"https://api.github.com/users/chethega/events{/privacy}","received_events_url":"https://api.github.com/users/chethega/received_events","type":"User","site_admin":false},"created_at":"2018-11-22T15:48:42Z","updated_at":"2018-11-22T15:48:42Z","author_association":"CONTRIBUTOR","body":"This is fixed on master. I think it is a duplicate of something with invalidating infererence cache entries. Note that this is order-dependent. On 1.0.1:\r\n\r\n```\r\njulia> begin\r\n       using SparseArrays\r\n       m, n = 2, 2\r\n       A    = ones(m, n)\r\n       B    = ones(Int8, m, n)\r\n       C    = sparse(1:min(m, n), 1:min(m, n), ones(Int8, min(m, n)), m, n);\r\n       typeof( (A .>= 0) .& (B .& 1 .== 1) .& (C .& 1 .== 1))\r\n       end\r\nSparseMatrixCSC{Any,Int64}\r\n```\r\n\r\n```\r\njulia> begin\r\n       using SparseArrays\r\n       m, n = 2, 2\r\n       A    = ones(m, n)\r\n       B    = ones(Int8, m, n)\r\n       C    = sparse(1:min(m, n), 1:min(m, n), ones(Int8, min(m, n)), m, n);\r\n       (A .>= 0);\r\n       (B .& 1 .== 1);\r\n       (A .>= 0) .& (B .& 1 .== 1);\r\n       (B .& 1 .== 1) .& (C .& 1 .== 1);\r\n       typeof( (A .>= 0) .& (B .& 1 .== 1) .& (C .& 1 .== 1) )\r\n       end\r\nSparseMatrixCSC{Bool,Int64}\r\n```\r\n"}}
{"actor":{"display_login":"chethega"}}