{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/comments/121264939","pull_request_review_id":43304670,"id":121264939,"diff_hunk":"@@ -166,11 +176,20 @@ end\n \n @inline function vector_mode_jacobian!(result, f::F, x::SArray{S,V,D,N}) where {F,S,V,D,N}\n     ydual = vector_mode_dual_eval(f, x)\n-    extract_jacobian!(result, ydual, N)\n-    extract_value!(result, ydual)\n+    result = extract_jacobian!(result, ydual, N)\n+    result = extract_value!(result, ydual)\n     return result\n end\n \n+@inline function vector_mode_jacobian!(out::ImmutableDiffResult, f::F, x::SArray{S,V,D,N}) where {F,S,V,D,N}\n+    ydual = vector_mode_dual_eval(f, x)\n+    jout = extract_jacobian(ydual, x)\n+    vout = extract_value(ydual, DiffBase.value(out))\n+    out = DiffBase.jacobian!(out, jout)\n+    out = DiffBase.value!(out, vout)\n+    return out\n+end","path":"src/jacobian.jl","position":48,"original_position":48,"commit_id":"f742bb212e308011ca81e72316aff0104ae5e132","original_commit_id":"f742bb212e308011ca81e72316aff0104ae5e132","user":{"login":"aaowens","id":8681040,"avatar_url":"https://avatars2.githubusercontent.com/u/8681040?v=3","gravatar_id":"","url":"https://api.github.com/users/aaowens","html_url":"https://github.com/aaowens","followers_url":"https://api.github.com/users/aaowens/followers","following_url":"https://api.github.com/users/aaowens/following{/other_user}","gists_url":"https://api.github.com/users/aaowens/gists{/gist_id}","starred_url":"https://api.github.com/users/aaowens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaowens/subscriptions","organizations_url":"https://api.github.com/users/aaowens/orgs","repos_url":"https://api.github.com/users/aaowens/repos","events_url":"https://api.github.com/users/aaowens/events{/privacy}","received_events_url":"https://api.github.com/users/aaowens/received_events","type":"User","site_admin":false},"body":"I ran into two issues here.\r\n1. `extract_jacobian!(result, ydual, N)` as written doesn't work because you cannot `setindex` on a reshaped `SArray`.\r\n2. I think `extract_value!(result, ydual)` did work, but was slow.\r\n\r\nSince the `@generated` function already existed for `extract_jacobian`, and it was straightforward to copy it for values, I used that approach here. I pass the value in `extract_value(ydual, DiffBase.value(out))` to get the shape right. In one of the tests the dimensions of `value(out)` are not the same as the native dimensions of `f(x)`.","created_at":"2017-06-10T19:45:01Z","updated_at":"2017-06-10T19:45:01Z","html_url":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/236#discussion_r121264939","pull_request_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/236","_links":{"self":{"href":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/comments/121264939"},"html":{"href":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/236#discussion_r121264939"},"pull_request":{"href":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/236"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/236","id":123553356,"html_url":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/236","diff_url":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/236.diff","patch_url":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/236.patch","issue_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/236","number":236,"state":"open","locked":false,"title":"Add ImmutableDiffResult methods","user":{"login":"aaowens","id":8681040,"avatar_url":"https://avatars2.githubusercontent.com/u/8681040?v=3","gravatar_id":"","url":"https://api.github.com/users/aaowens","html_url":"https://github.com/aaowens","followers_url":"https://api.github.com/users/aaowens/followers","following_url":"https://api.github.com/users/aaowens/following{/other_user}","gists_url":"https://api.github.com/users/aaowens/gists{/gist_id}","starred_url":"https://api.github.com/users/aaowens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaowens/subscriptions","organizations_url":"https://api.github.com/users/aaowens/orgs","repos_url":"https://api.github.com/users/aaowens/repos","events_url":"https://api.github.com/users/aaowens/events{/privacy}","received_events_url":"https://api.github.com/users/aaowens/received_events","type":"User","site_admin":false},"body":"This is an attempt to add methods to `gradient!` and other `!` methods which return ImmutableDiffResults. It passes the `Number` and StaticArrays tests once they are modified to return the result instead of trying to mutate it. \r\n\r\nThe `ImmutableDiffResult` input is just for dispatch purposes and isn't actually used anywhere. It might be desirable to add some type signatures to make sure the returned type is the same as the input type.","created_at":"2017-06-01T17:33:02Z","updated_at":"2017-06-10T19:45:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ebf50341a3b3f8b6440a603167d53277faec1f07","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/236/commits","review_comments_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/236/comments","review_comment_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/236/comments","statuses_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/statuses/f742bb212e308011ca81e72316aff0104ae5e132","head":{"label":"aaowens:Immutable","ref":"Immutable","sha":"f742bb212e308011ca81e72316aff0104ae5e132","user":{"login":"aaowens","id":8681040,"avatar_url":"https://avatars2.githubusercontent.com/u/8681040?v=3","gravatar_id":"","url":"https://api.github.com/users/aaowens","html_url":"https://github.com/aaowens","followers_url":"https://api.github.com/users/aaowens/followers","following_url":"https://api.github.com/users/aaowens/following{/other_user}","gists_url":"https://api.github.com/users/aaowens/gists{/gist_id}","starred_url":"https://api.github.com/users/aaowens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaowens/subscriptions","organizations_url":"https://api.github.com/users/aaowens/orgs","repos_url":"https://api.github.com/users/aaowens/repos","events_url":"https://api.github.com/users/aaowens/events{/privacy}","received_events_url":"https://api.github.com/users/aaowens/received_events","type":"User","site_admin":false},"repo":{"id":90107355,"name":"ForwardDiff.jl","full_name":"aaowens/ForwardDiff.jl","owner":{"login":"aaowens","id":8681040,"avatar_url":"https://avatars2.githubusercontent.com/u/8681040?v=3","gravatar_id":"","url":"https://api.github.com/users/aaowens","html_url":"https://github.com/aaowens","followers_url":"https://api.github.com/users/aaowens/followers","following_url":"https://api.github.com/users/aaowens/following{/other_user}","gists_url":"https://api.github.com/users/aaowens/gists{/gist_id}","starred_url":"https://api.github.com/users/aaowens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaowens/subscriptions","organizations_url":"https://api.github.com/users/aaowens/orgs","repos_url":"https://api.github.com/users/aaowens/repos","events_url":"https://api.github.com/users/aaowens/events{/privacy}","received_events_url":"https://api.github.com/users/aaowens/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aaowens/ForwardDiff.jl","description":"Forward Mode Automatic Differentiation for Julia","fork":true,"url":"https://api.github.com/repos/aaowens/ForwardDiff.jl","forks_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/forks","keys_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/teams","hooks_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/hooks","issue_events_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/issues/events{/number}","events_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/events","assignees_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/assignees{/user}","branches_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/branches{/branch}","tags_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/tags","blobs_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/languages","stargazers_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/stargazers","contributors_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/contributors","subscribers_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/subscribers","subscription_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/subscription","commits_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/contents/{+path}","compare_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/merges","archive_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/downloads","issues_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/issues{/number}","pulls_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/labels{/name}","releases_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/releases{/id}","deployments_url":"https://api.github.com/repos/aaowens/ForwardDiff.jl/deployments","created_at":"2017-05-03T04:14:00Z","updated_at":"2017-05-03T04:14:02Z","pushed_at":"2017-06-10T01:44:38Z","git_url":"git://github.com/aaowens/ForwardDiff.jl.git","ssh_url":"git@github.com:aaowens/ForwardDiff.jl.git","clone_url":"https://github.com/aaowens/ForwardDiff.jl.git","svn_url":"https://github.com/aaowens/ForwardDiff.jl","homepage":"","size":2110,"stargazers_count":0,"watchers_count":0,"language":"Julia","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"JuliaDiff:master","ref":"master","sha":"9a24080b6973f56c71f032704e41a71c7affe6a5","user":{"login":"JuliaDiff","id":7750915,"avatar_url":"https://avatars3.githubusercontent.com/u/7750915?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaDiff","html_url":"https://github.com/JuliaDiff","followers_url":"https://api.github.com/users/JuliaDiff/followers","following_url":"https://api.github.com/users/JuliaDiff/following{/other_user}","gists_url":"https://api.github.com/users/JuliaDiff/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaDiff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaDiff/subscriptions","organizations_url":"https://api.github.com/users/JuliaDiff/orgs","repos_url":"https://api.github.com/users/JuliaDiff/repos","events_url":"https://api.github.com/users/JuliaDiff/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaDiff/received_events","type":"Organization","site_admin":false},"repo":{"id":9411959,"name":"ForwardDiff.jl","full_name":"JuliaDiff/ForwardDiff.jl","owner":{"login":"JuliaDiff","id":7750915,"avatar_url":"https://avatars3.githubusercontent.com/u/7750915?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaDiff","html_url":"https://github.com/JuliaDiff","followers_url":"https://api.github.com/users/JuliaDiff/followers","following_url":"https://api.github.com/users/JuliaDiff/following{/other_user}","gists_url":"https://api.github.com/users/JuliaDiff/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaDiff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaDiff/subscriptions","organizations_url":"https://api.github.com/users/JuliaDiff/orgs","repos_url":"https://api.github.com/users/JuliaDiff/repos","events_url":"https://api.github.com/users/JuliaDiff/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaDiff/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaDiff/ForwardDiff.jl","description":"Forward Mode Automatic Differentiation for Julia","fork":false,"url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl","forks_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/forks","keys_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/teams","hooks_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/events","assignees_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/tags","blobs_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/subscription","commits_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/merges","archive_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/downloads","issues_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/deployments","created_at":"2013-04-13T10:19:04Z","updated_at":"2017-06-06T09:21:06Z","pushed_at":"2017-06-10T01:44:38Z","git_url":"git://github.com/JuliaDiff/ForwardDiff.jl.git","ssh_url":"git@github.com:JuliaDiff/ForwardDiff.jl.git","clone_url":"https://github.com/JuliaDiff/ForwardDiff.jl.git","svn_url":"https://github.com/JuliaDiff/ForwardDiff.jl","homepage":"","size":2009,"stargazers_count":109,"watchers_count":109,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":32,"mirror_url":null,"open_issues_count":20,"forks":32,"open_issues":20,"watchers":109,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/236"},"html":{"href":"https://github.com/JuliaDiff/ForwardDiff.jl/pull/236"},"issue":{"href":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/236"},"comments":{"href":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/issues/236/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/236/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/pulls/236/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaDiff/ForwardDiff.jl/statuses/f742bb212e308011ca81e72316aff0104ae5e132"}}}}
{"actor":{"display_login":"aaowens"}}