{"action":"opened","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/10616","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/10616/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/10616/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/10616/events","html_url":"https://github.com/JuliaLang/julia/issues/10616","id":63973498,"number":10616,"title":"generic matmul depends on zero","user":{"login":"StefanKarpinski","id":153596,"avatar_url":"https://avatars.githubusercontent.com/u/153596?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanKarpinski","html_url":"https://github.com/StefanKarpinski","followers_url":"https://api.github.com/users/StefanKarpinski/followers","following_url":"https://api.github.com/users/StefanKarpinski/following{/other_user}","gists_url":"https://api.github.com/users/StefanKarpinski/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanKarpinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanKarpinski/subscriptions","organizations_url":"https://api.github.com/users/StefanKarpinski/orgs","repos_url":"https://api.github.com/users/StefanKarpinski/repos","events_url":"https://api.github.com/users/StefanKarpinski/events{/privacy}","received_events_url":"https://api.github.com/users/StefanKarpinski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-24T11:33:58Z","updated_at":"2015-03-24T11:33:58Z","closed_at":null,"body":"Currently generic matmul uses `zero(eltype(a))` to fill the initial output array with zero values. When defining a new numeric type, this can be annoying (you may not have defined a `zero` method yet), but there are also real-world case where this causes matmul to fail, such as when you have an `Any` array that just happens to contain numbers that you want to multiply:\r\n\r\n```jl\r\njulia> A = convert(Array{Any}, rand(3,4))\r\n3x4 Array{Any,2}:\r\n 0.994922  0.18993   0.826601  0.82501\r\n 0.10378   0.937165  0.753685  0.321605\r\n 0.269249  0.678925  0.749532  0.305874\r\n\r\njulia> A*rand(4)\r\nERROR: MethodError: `zero` has no method matching zero(::Type{Any})\r\n in generic_matvecmul! at linalg/matmul.jl:319\r\n in * at linalg/matmul.jl:74\r\n```\r\n\r\nOn the one hand, you really want this to be a `Float64` matrix for performance. But on the other hand, this really ought to work in any case."}}