{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/comments/89630953","pull_request_review_id":10176105,"id":89630953,"diff_hunk":"@@ -37,3 +56,78 @@ function show{uType,tType,isinplace,F}(io::IO,prob::AbstractODEProblem{uType,tTy\n   nothing\n end\n =#\n+\n+###\n+# Promotion & conversion\n+promote(prob::ODEProblem, ::AbstractDAEAlgorithm) = convert(DAEProblem, prob)\n+promote(prob::ODETestProblem, ::AbstractDAEAlgorithm) = convert(DAETestProblem, prob)\n+function convert{P<:AbstractDAEProblem}(::Type{P}, prob::AbstractODEProblem)\n+    @unpack f,u0,tspan = prob\n+    f_new = convert_obj_fn(P,prob)\n+    # IC\n+    if isinplace(prob)\n+        du0 = similar(u0) # TODO: this needs to be Unit-stable (Chris, help!)\n+        f(prob.tspan[1], u0, du0)\n+    else\n+        du0 = f(prob.tspan[1], u0)\n+    end\n+    # overloaded functions\n+    for m in methods_overloaded(f)\n+        val = get_first_arg(m) # get Val{:jac} etc\n+        convert_overloaded!(DAEProblem, prob, val, f_new) # updates f_new in-place\n+    end\n+    # construct\n+    if P==DAEProblem\n+        P(f_new, u0, du0, tspan)\n+    elseif isa(prob,ODETestProblem) && P==DAETestProblem\n+        P(f_new, u0, du0, prob.analytic, tspan)\n+    else\n+        error(\"Cannot convert non-test problem into test-problem.\")\n+    end\n+end\n+\n+#\"Convert the objective function `f` or prob\"\n+@traitfn function convert_obj_fn{T<:AbstractDAEProblem, P2<:AbstractODEProblem}(::Type{T}, prob::P2::IsInplace)\n+    f = prob.f\n+    return function (t,u,du,out)\n+        f(t,u,out)\n+        out .= .-(out, du) # change in 0.6\n+    end\n+end\n+@traitfn function convert_obj_fn{T<:AbstractDAEProblem, P2<:AbstractODEProblem}(::Type{T}, prob::P2::(!IsInplace))\n+    f = prob.f\n+    return (t,u,du) -> .-(f(t,u), du) # change in 0.6\n+end\n+\n+\"\"\"\n+Converts one method of a overloaded generic function to the new problem-type.\n+\n+`convert_overloaded!(T, prob, Val{:sometag}, f_new)`\n+\n+Input:\n+- T: type of new AbstractIVPProblem\n+- prob: old problem instance\n+- Val{:sometag}: convert `:sometag` method\n+- `f_new`: the generic function to which the converted method is added\n+\n+Out:\n+- nothing\n+\"\"\"\n+function convert_overloaded!{T<:AbstractIVPProblem}(::Type{T}, prob::AbstractIVPProblem, ::Val, f_new)","path":"src/problems/dae_problems.jl","position":84,"original_position":84,"commit_id":"b2abe7727cef43f33baf23d91034e502b8336ab0","original_commit_id":"b2abe7727cef43f33baf23d91034e502b8336ab0","user":{"login":"mauro3","id":4098145,"avatar_url":"https://avatars.githubusercontent.com/u/4098145?v=3","gravatar_id":"","url":"https://api.github.com/users/mauro3","html_url":"https://github.com/mauro3","followers_url":"https://api.github.com/users/mauro3/followers","following_url":"https://api.github.com/users/mauro3/following{/other_user}","gists_url":"https://api.github.com/users/mauro3/gists{/gist_id}","starred_url":"https://api.github.com/users/mauro3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauro3/subscriptions","organizations_url":"https://api.github.com/users/mauro3/orgs","repos_url":"https://api.github.com/users/mauro3/repos","events_url":"https://api.github.com/users/mauro3/events{/privacy}","received_events_url":"https://api.github.com/users/mauro3/received_events","type":"User","site_admin":false},"body":"For each overloaded-function and <:AbstractIVPProblem, a conversion needs to be defined.","created_at":"2016-11-25T15:16:56Z","updated_at":"2016-11-25T15:16:56Z","html_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl/pull/11#discussion_r89630953","pull_request_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/comments/89630953"},"html":{"href":"https://github.com/JuliaDiffEq/DiffEqBase.jl/pull/11#discussion_r89630953"},"pull_request":{"href":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/11","id":95318054,"html_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl/pull/11","diff_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl/pull/11.diff","patch_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl/pull/11.patch","issue_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues/11","number":11,"state":"open","locked":false,"title":"WIP: ODE->DAE promotion","user":{"login":"mauro3","id":4098145,"avatar_url":"https://avatars.githubusercontent.com/u/4098145?v=3","gravatar_id":"","url":"https://api.github.com/users/mauro3","html_url":"https://github.com/mauro3","followers_url":"https://api.github.com/users/mauro3/followers","following_url":"https://api.github.com/users/mauro3/following{/other_user}","gists_url":"https://api.github.com/users/mauro3/gists{/gist_id}","starred_url":"https://api.github.com/users/mauro3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauro3/subscriptions","organizations_url":"https://api.github.com/users/mauro3/orgs","repos_url":"https://api.github.com/users/mauro3/repos","events_url":"https://api.github.com/users/mauro3/events{/privacy}","received_events_url":"https://api.github.com/users/mauro3/received_events","type":"User","site_admin":false},"body":"Fixes #1\r\n\r\nIt wasn't as easy as I thought it would be...\r\n\r\nNote, for the tests to pass [this line](https://github.com/JuliaDiffEq/StochasticDiffEq.jl/blob/e0f46ffb37d0e908083df4df5ce15815d050dad0/src/sde/sde_solve.jl#L1) needs to be changed to `function solve{uType,tType,isinplace,NoiseClass,F,F2,F3,algType<:AbstractSDEAlgorithm}(`.","created_at":"2016-11-25T15:12:03Z","updated_at":"2016-11-25T15:16:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b91ad814ae4341446f0fa1a80e6227cc1d6530ce","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/11/commits","review_comments_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/11/comments","review_comment_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues/11/comments","statuses_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/statuses/b2abe7727cef43f33baf23d91034e502b8336ab0","head":{"label":"JuliaDiffEq:m3/promotion","ref":"m3/promotion","sha":"b2abe7727cef43f33baf23d91034e502b8336ab0","user":{"login":"JuliaDiffEq","id":21238080,"avatar_url":"https://avatars.githubusercontent.com/u/21238080?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaDiffEq","html_url":"https://github.com/JuliaDiffEq","followers_url":"https://api.github.com/users/JuliaDiffEq/followers","following_url":"https://api.github.com/users/JuliaDiffEq/following{/other_user}","gists_url":"https://api.github.com/users/JuliaDiffEq/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaDiffEq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaDiffEq/subscriptions","organizations_url":"https://api.github.com/users/JuliaDiffEq/orgs","repos_url":"https://api.github.com/users/JuliaDiffEq/repos","events_url":"https://api.github.com/users/JuliaDiffEq/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaDiffEq/received_events","type":"Organization","site_admin":false},"repo":{"id":71509444,"name":"DiffEqBase.jl","full_name":"JuliaDiffEq/DiffEqBase.jl","owner":{"login":"JuliaDiffEq","id":21238080,"avatar_url":"https://avatars.githubusercontent.com/u/21238080?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaDiffEq","html_url":"https://github.com/JuliaDiffEq","followers_url":"https://api.github.com/users/JuliaDiffEq/followers","following_url":"https://api.github.com/users/JuliaDiffEq/following{/other_user}","gists_url":"https://api.github.com/users/JuliaDiffEq/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaDiffEq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaDiffEq/subscriptions","organizations_url":"https://api.github.com/users/JuliaDiffEq/orgs","repos_url":"https://api.github.com/users/JuliaDiffEq/repos","events_url":"https://api.github.com/users/JuliaDiffEq/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaDiffEq/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl","description":"The lightweight Base library for shared types and functionality.","fork":false,"url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl","forks_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/forks","keys_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/teams","hooks_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/events","assignees_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/tags","blobs_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/subscription","commits_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/merges","archive_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/downloads","issues_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/deployments","created_at":"2016-10-20T22:28:36Z","updated_at":"2016-11-23T21:28:37Z","pushed_at":"2016-11-25T15:12:04Z","git_url":"git://github.com/JuliaDiffEq/DiffEqBase.jl.git","ssh_url":"git@github.com:JuliaDiffEq/DiffEqBase.jl.git","clone_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl.git","svn_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl","homepage":null,"size":97,"stargazers_count":1,"watchers_count":1,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":7,"forks":1,"open_issues":7,"watchers":1,"default_branch":"master"}},"base":{"label":"JuliaDiffEq:master","ref":"master","sha":"6cc12def8af8e7e51b458d65f48e43d97aee4af1","user":{"login":"JuliaDiffEq","id":21238080,"avatar_url":"https://avatars.githubusercontent.com/u/21238080?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaDiffEq","html_url":"https://github.com/JuliaDiffEq","followers_url":"https://api.github.com/users/JuliaDiffEq/followers","following_url":"https://api.github.com/users/JuliaDiffEq/following{/other_user}","gists_url":"https://api.github.com/users/JuliaDiffEq/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaDiffEq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaDiffEq/subscriptions","organizations_url":"https://api.github.com/users/JuliaDiffEq/orgs","repos_url":"https://api.github.com/users/JuliaDiffEq/repos","events_url":"https://api.github.com/users/JuliaDiffEq/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaDiffEq/received_events","type":"Organization","site_admin":false},"repo":{"id":71509444,"name":"DiffEqBase.jl","full_name":"JuliaDiffEq/DiffEqBase.jl","owner":{"login":"JuliaDiffEq","id":21238080,"avatar_url":"https://avatars.githubusercontent.com/u/21238080?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaDiffEq","html_url":"https://github.com/JuliaDiffEq","followers_url":"https://api.github.com/users/JuliaDiffEq/followers","following_url":"https://api.github.com/users/JuliaDiffEq/following{/other_user}","gists_url":"https://api.github.com/users/JuliaDiffEq/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaDiffEq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaDiffEq/subscriptions","organizations_url":"https://api.github.com/users/JuliaDiffEq/orgs","repos_url":"https://api.github.com/users/JuliaDiffEq/repos","events_url":"https://api.github.com/users/JuliaDiffEq/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaDiffEq/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl","description":"The lightweight Base library for shared types and functionality.","fork":false,"url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl","forks_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/forks","keys_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/teams","hooks_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/events","assignees_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/tags","blobs_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/subscription","commits_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/merges","archive_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/downloads","issues_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/deployments","created_at":"2016-10-20T22:28:36Z","updated_at":"2016-11-23T21:28:37Z","pushed_at":"2016-11-25T15:12:04Z","git_url":"git://github.com/JuliaDiffEq/DiffEqBase.jl.git","ssh_url":"git@github.com:JuliaDiffEq/DiffEqBase.jl.git","clone_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl.git","svn_url":"https://github.com/JuliaDiffEq/DiffEqBase.jl","homepage":null,"size":97,"stargazers_count":1,"watchers_count":1,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":7,"forks":1,"open_issues":7,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/11"},"html":{"href":"https://github.com/JuliaDiffEq/DiffEqBase.jl/pull/11"},"issue":{"href":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues/11"},"comments":{"href":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaDiffEq/DiffEqBase.jl/statuses/b2abe7727cef43f33baf23d91034e502b8336ab0"}}}}
{"actor":{"display_login":"mauro3"}}