{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/27","labels_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/27/comments","events_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/27/events","html_url":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/27","id":95477445,"number":27,"title":"WIP: Refactor ForwardDiff to utilize NDuals and replace API","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},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":26,"created_at":"2015-07-16T16:49:27Z","updated_at":"2015-08-14T19:17:38Z","closed_at":"2015-08-14T18:59:29Z","pull_request":{"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/27","html_url":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/27","diff_url":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/27.diff","patch_url":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/27.patch"},"body":"This PR does a lot of stuff...likely *way* more than should fit in one PR, but I got a bit carried away with my refactor.\r\n\r\n### Changes \r\n\r\n- Removes the old, non-implemented `matrix_fad`, `powerseries_fad`, and `dual_fad` folders, and moved the contents of `typed_fad` to `src`.\r\n\r\n- Now that all the other methods (`matrix_fad`, `powerseries_fad`) are gone, the API can be simplified, so I took a crack at it. I'll be working on documentation soon, but the [exported functions list](https://github.com/JuliaDiff/ForwardDiff.jl/blob/nduals-refactor/src/ForwardDiff.jl) and [fad_api.jl](https://github.com/JuliaDiff/ForwardDiff.jl/blob/nduals-refactor/src/fad_api.jl) contain the relevant code necessary to understand my attempt.\r\n\r\n- The [fad_api](https://github.com/JuliaDiff/ForwardDiff.jl/blob/nduals-refactor/src/fad_api/)  contains a port and extension of the work from [AutoDiffJSoC.jl](https://github.com/jrevels/AutoDiffJSoC.jl), with a bunch of generalizations and optimizations. ~~Notably, it makes more use of my \"generated function closure caching trick (TM)\" in order to speed up/reuse memory when repeatedly using the same NDuals type to take the gradient/Hessian/etc. This technique has the potential to dangerously behave like a memory leak in a specific edge case (read the code comments), but I can't imagine a user ever reaching that case in a real world situation.~~ It also supports a caching layer for re-usage of work arrays (documented in the README).\r\n\r\n- Renames the `FAD*` types to `*Number` (e.g. `FADHessian` --> `HessianNumber`).\r\n\r\n- ~~Refactors `FADHessian` and `FADTensor` to utilize NDuals.jl, thereby allowing the removal of `GraDual` and dependence on DualNumbers.jl.~~ Ports in the work from NDuals.jl as a new type, `GradientNumber`.\r\n\r\n- Bumps up the required Julia version from v0.3 to v0.4, which is required for `GradientNum` and downstream types.\r\n\r\n- Major refactor of ~~FADHessian.jl~~ HessianNum.jl and ~~FADTensor.jl~~ TensorNum.jl:\r\n    - Improved readability by lengthening some single-character variable names\r\n    - Automatically generate definitions for univariate mathematical functions using Calculus.jl. This reduces potential for bugs, greatly expands supported functionality, and greatly reduces the duplication of code.\r\n    - Unified the code/behavior shared between the `GradientNumber`, `HessianNumber`, and `TensorNumber` types under a new supertype, `ForwardDiffNumber <: Number`.\r\n    - Replaced all the `.`-based accesses that plagued the old implementation with consistent calls to proper accessor methods .\r\n    - Removed temporary array usage where possible, cut down on repetitive array accesses, and rewrote loops to be more concise.\r\n\r\n- On top of flipping everything else on its head, I switched to using 4 spaces for indents instead of 2. This is just my preference - I think it reads better and it fits Julia’s contributing guidelines for Base (which we obviously don’t have to follow, but it’s nice to fit in).\r\n\r\n### Still in progress\r\n\r\n- [x] Tests for new API\r\n- [x] Tests for `F<:ForwardDiffNumber` types\r\n    - [x] `GradientNumber`\r\n        - [x] Utility/accessor function tests\r\n        - [x] Math tests\r\n    - [x] `HessianNumber`\r\n        - [x] Utility/accessor function tests\r\n        - [x] Math tests\r\n    - [x] `TensorNumber`\r\n        - [x] Utility/accessor function tests\r\n        - [x] Math tests\r\n- [x] Deprecate old API\r\n- [x] Documentation to correspond to new API\r\n- [x] Add Coveralls.io support\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/comments/131213040","html_url":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/27#issuecomment-131213040","issue_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/27","id":131213040,"user":{"login":"felipenoris","id":12482900,"avatar_url":"https://avatars.githubusercontent.com/u/12482900?v=3","gravatar_id":"","url":"https://api.github.com/users/felipenoris","html_url":"https://github.com/felipenoris","followers_url":"https://api.github.com/users/felipenoris/followers","following_url":"https://api.github.com/users/felipenoris/following{/other_user}","gists_url":"https://api.github.com/users/felipenoris/gists{/gist_id}","starred_url":"https://api.github.com/users/felipenoris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felipenoris/subscriptions","organizations_url":"https://api.github.com/users/felipenoris/orgs","repos_url":"https://api.github.com/users/felipenoris/repos","events_url":"https://api.github.com/users/felipenoris/events{/privacy}","received_events_url":"https://api.github.com/users/felipenoris/received_events","type":"User","site_admin":false},"created_at":"2015-08-14T19:17:38Z","updated_at":"2015-08-14T19:17:38Z","body":"Awesome! Thank you!"}}