{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/174","repository_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl","labels_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/174/labels{/name}","comments_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/174/comments","events_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/174/events","html_url":"https://github.com/JuliaDiff/ForwardDiff.jl/issues/174","id":194988781,"number":174,"title":"support for `Base.expm` (need advice implementing)","user":{"login":"tpapp","id":84122,"avatar_url":"https://avatars.githubusercontent.com/u/84122?v=3","gravatar_id":"","url":"https://api.github.com/users/tpapp","html_url":"https://github.com/tpapp","followers_url":"https://api.github.com/users/tpapp/followers","following_url":"https://api.github.com/users/tpapp/following{/other_user}","gists_url":"https://api.github.com/users/tpapp/gists{/gist_id}","starred_url":"https://api.github.com/users/tpapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpapp/subscriptions","organizations_url":"https://api.github.com/users/tpapp/orgs","repos_url":"https://api.github.com/users/tpapp/repos","events_url":"https://api.github.com/users/tpapp/events{/privacy}","received_events_url":"https://api.github.com/users/tpapp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-12T14:32:42Z","updated_at":"2016-12-12T16:29:31Z","closed_at":null,"body":"It would be very nice to have support for AD in `Base.expm`. I would like to contribute to it, but since I am unfamiliar with the AD architecture in Julia I would appreciate some advice.\r\n\r\nFor Frechet derivatives, the recommended approach is [Al-Mohy and Higham (2009)](http://epubs.siam.org/doi/abs/10.1137/080716426). But I am unsure that this is the best approach for AD.\r\n\r\nI came across an [article by Mike Giles](https://people.maths.ox.ac.uk/gilesm/files/NA-08-01.pdf) on AD and matrix functions. Section 2.3.5 in this paper suggests that if one uses the squaring and scaling algorithm, AD calculations just amount to the solution of linear systems and matrix powers, both of which go through nicely.\r\n\r\n`Base.expm!` uses Julia functions, except for two LAPACK ones, `gebal!` and `gesv!`, for balancing and solving linear systems, respectively. I am under the impression that AD already goes through linear systems, so it could be replaced. So all one would need to do is implement `gebal` in Julia, and replace `gesv!` by `\\`, perhaps at the cost of some extra allocation.\r\n\r\nAm I on the right track with this?"},"comment":{"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/comments/266477562","html_url":"https://github.com/JuliaDiff/ForwardDiff.jl/issues/174#issuecomment-266477562","issue_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/174","id":266477562,"user":{"login":"tpapp","id":84122,"avatar_url":"https://avatars.githubusercontent.com/u/84122?v=3","gravatar_id":"","url":"https://api.github.com/users/tpapp","html_url":"https://github.com/tpapp","followers_url":"https://api.github.com/users/tpapp/followers","following_url":"https://api.github.com/users/tpapp/following{/other_user}","gists_url":"https://api.github.com/users/tpapp/gists{/gist_id}","starred_url":"https://api.github.com/users/tpapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpapp/subscriptions","organizations_url":"https://api.github.com/users/tpapp/orgs","repos_url":"https://api.github.com/users/tpapp/repos","events_url":"https://api.github.com/users/tpapp/events{/privacy}","received_events_url":"https://api.github.com/users/tpapp/received_events","type":"User","site_admin":false},"created_at":"2016-12-12T16:29:31Z","updated_at":"2016-12-12T16:29:31Z","body":"@jrevels: Thanks. Looking at `ReverseDiff`, the key to supporting a calculation again seems to be having it in pure Julia. So by providing an alternative implementation for `expm` that does not use LAPACK, I could get both `ReverseDiff` and `ForwardDiff` to work, is that correct?"}}
{"actor":{"display_login":"tpapp"}}