{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/159","repository_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl","labels_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/159/labels{/name}","comments_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/159/comments","events_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/159/events","html_url":"https://github.com/JuliaDiff/ForwardDiff.jl/issues/159","id":190503867,"number":159,"title":"gradient() now works properly with StaticArrays","user":{"login":"rdeits","id":591886,"avatar_url":"https://avatars.githubusercontent.com/u/591886?v=3","gravatar_id":"","url":"https://api.github.com/users/rdeits","html_url":"https://github.com/rdeits","followers_url":"https://api.github.com/users/rdeits/followers","following_url":"https://api.github.com/users/rdeits/following{/other_user}","gists_url":"https://api.github.com/users/rdeits/gists{/gist_id}","starred_url":"https://api.github.com/users/rdeits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdeits/subscriptions","organizations_url":"https://api.github.com/users/rdeits/orgs","repos_url":"https://api.github.com/users/rdeits/repos","events_url":"https://api.github.com/users/rdeits/events{/privacy}","received_events_url":"https://api.github.com/users/rdeits/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-19T15:59:36Z","updated_at":"2016-11-26T17:13:32Z","closed_at":"2016-11-26T16:23:30Z","body":"This is not a bug, but rather an improvement that you might not have been aware of. It looks like d9809c6543db95ab384b24701a3a17226660b603 had a side-benefit of fixing an issue I have been running into, in which StaticArrays MVector types caused errors when taking gradients:\r\n\r\nbefore:\r\n\r\n```julia\r\njulia> ForwardDiff.gradient(x -> sum(x), MVector(1., 2., 3.))\r\nERROR: TypeError: typeassert: expected Tuple{ForwardDiff.JacobianCache{3,Float64,StaticArrays.MVector{3,ForwardDiff.Dual{3,Float64}}}}, got Tuple{ForwardDiff.JacobianCache{3,Float64,Array{ForwardDiff.Dual{3,Float64},1}}}\r\n in multithread_jacobian_cachefetch!(::StaticArrays.MVector{3,Float64}, ::ForwardDiff.Chunk{3}, ::Bool, ::Bool) at /Users/rdeits/locomotion/explorations/point-cloud-signed-distance/packages/v0.5/ForwardDiff/src/cache.jl:71\r\n in jacobian_cachefetch! at /Users/rdeits/locomotion/explorations/point-cloud-signed-distance/packages/v0.5/ForwardDiff/src/cache.jl:74 [inlined]\r\n in compute_vector_mode_gradient(::##5#6, ::StaticArrays.MVector{3,Float64}, ::ForwardDiff.Chunk{3}, ::Bool) at /Users/rdeits/locomotion/explorations/point-cloud-signed-distance/packages/v0.5/ForwardDiff/src/gradient.jl:87\r\n in vector_mode_gradient at /Users/rdeits/locomotion/explorations/point-cloud-signed-distance/packages/v0.5/ForwardDiff/src/gradient.jl:94 [inlined]\r\n in #gradient#33(::Bool, ::Bool, ::Function, ::Function, ::StaticArrays.MVector{3,Float64}, ::ForwardDiff.Chunk{3}) at /Users/rdeits/locomotion/explorations/point-cloud-signed-distance/packages/v0.5/ForwardDiff/src/gradient.jl:23\r\n in gradient(::Function, ::StaticArrays.MVector{3,Float64}, ::ForwardDiff.Chunk{3}) at /Users/rdeits/locomotion/explorations/point-cloud-signed-distance/packages/v0.5/ForwardDiff/src/gradient.jl:22 (repeats 2 times)\r\n```\r\n\r\nand after d9809c6543db95ab384b24701a3a17226660b603 :\r\n\r\n```julia\r\njulia> ForwardDiff.gradient(x -> sum(x), MVector(1., 2., 3.))\r\n3-element StaticArrays.MVector{3,Float64}:\r\n 1.0\r\n 1.0\r\n 1.0\r\n```\r\n\r\nThanks for all your hard work! ForwardDiff is awesome! "},"comment":{"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/comments/263074674","html_url":"https://github.com/JuliaDiff/ForwardDiff.jl/issues/159#issuecomment-263074674","issue_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/159","id":263074674,"user":{"login":"jrevels","id":3277443,"avatar_url":"https://avatars.githubusercontent.com/u/3277443?v=3","gravatar_id":"","url":"https://api.github.com/users/jrevels","html_url":"https://github.com/jrevels","followers_url":"https://api.github.com/users/jrevels/followers","following_url":"https://api.github.com/users/jrevels/following{/other_user}","gists_url":"https://api.github.com/users/jrevels/gists{/gist_id}","starred_url":"https://api.github.com/users/jrevels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrevels/subscriptions","organizations_url":"https://api.github.com/users/jrevels/orgs","repos_url":"https://api.github.com/users/jrevels/repos","events_url":"https://api.github.com/users/jrevels/events{/privacy}","received_events_url":"https://api.github.com/users/jrevels/received_events","type":"User","site_admin":false},"created_at":"2016-11-26T17:13:32Z","updated_at":"2016-11-26T17:13:32Z","body":"Oh, cool! I had assumed it wouldn't work because calculations where `chunk size != input length` require a mutable array, but didn't realize (until I checked just now) that StaticArrays implemented mutable array types. \r\n\r\nThanks again for the heads up!"}}
{"actor":{"display_login":"jrevels"}}