{"action":"created","comment":{"url":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/comments/39953934","id":39953934,"diff_hunk":"@@ -0,0 +1,87 @@\n+type ScaledInterpolation{T,N,ITPT,IT,GT,RT} <: AbstractInterpolationWrapper{T,N,ITPT,IT,GT}\n+    itp::ITPT\n+    ranges::RT\n+end\n+ScaledInterpolation{T,ITPT,IT,GT,RT}(::Type{T}, N, itp::ITPT, ::Type{IT}, ::Type{GT}, ranges::RT) =\n+    ScaledInterpolation{T,N,ITPT,IT,GT,RT}(itp, ranges)\n+@doc \"\"\"\n+`scale(itp, xs, ys, ...)` scales an existing interpolation object to allow for indexing using other coordinate axes than unit ranges, by wrapping the interpolation object and transforming the indices from the provided axes onto unit ranges upon indexing.","path":"src/scaling/scaling.jl","position":8,"original_position":8,"commit_id":"6e0235b649c51184e714192462440df979842847","original_commit_id":"6e0235b649c51184e714192462440df979842847","user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"body":"In a sense, `(xs,ys,...)` is equivalent to `knots` in the Gridded interpolant, with the very important difference that Range inputs provide very nice extra algorithmic guarantees that make everything more efficient and mesh seamlessly with our `BSpline` infrastructure.\r\n\r\nGiven that *conceptual* equivalence, however, I suspect we should not have `knots` come first with `Gridded` and `xs, ys, ...` come second with `scale`. I would propose `scale(knots, itp)` but I am comfortable changing `Gridded` instead.","created_at":"2015-09-21T09:37:23Z","updated_at":"2015-09-21T09:37:23Z","html_url":"https://github.com/tlycken/Interpolations.jl/pull/47#discussion_r39953934","pull_request_url":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/comments/39953934"},"html":{"href":"https://github.com/tlycken/Interpolations.jl/pull/47#discussion_r39953934"},"pull_request":{"href":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/47","id":40374259,"html_url":"https://github.com/tlycken/Interpolations.jl/pull/47","diff_url":"https://github.com/tlycken/Interpolations.jl/pull/47.diff","patch_url":"https://github.com/tlycken/Interpolations.jl/pull/47.patch","issue_url":"https://api.github.com/repos/tlycken/Interpolations.jl/issues/47","number":47,"state":"open","locked":false,"title":"RFC: Scaling of interpolation objects (fixes #25)","user":{"login":"tlycken","id":1550920,"avatar_url":"https://avatars.githubusercontent.com/u/1550920?v=3","gravatar_id":"","url":"https://api.github.com/users/tlycken","html_url":"https://github.com/tlycken","followers_url":"https://api.github.com/users/tlycken/followers","following_url":"https://api.github.com/users/tlycken/following{/other_user}","gists_url":"https://api.github.com/users/tlycken/gists{/gist_id}","starred_url":"https://api.github.com/users/tlycken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlycken/subscriptions","organizations_url":"https://api.github.com/users/tlycken/orgs","repos_url":"https://api.github.com/users/tlycken/repos","events_url":"https://api.github.com/users/tlycken/events{/privacy}","received_events_url":"https://api.github.com/users/tlycken/received_events","type":"User","site_admin":false},"body":"This is a start at implementing the functionality provided to Grid.jl by the CoordInterpGrid type, and in fact the code here is heavily based on that contributed by @simonbyrne there.\r\n\r\nSimon, do you have any objections to me basing this implementation off of your code? If so, please feel free to object here, and I'll remove this and come up with something from scratch. It's just that borrowing is so easy ;)\r\n\r\nThe basic idea is that you can do\r\n\r\n```julia\r\nf(x) = exp(-x.^2 ./ 4)\r\nxs = -5:.2:5\r\nys = f(xs)\r\nitp = interpolate(ys, BSpline(Linear), OnGrid)\r\n\r\ns = scale(itp, xs)   # now, s[-2.3] ~= f(-2.3)\r\n```\r\n\r\nTo scale in higher dimensions, you just tuck on more ranges at the end, one range for each dimension (i.e. `scale(itp2, xs, ys)` to scale a 2D interpolation object).\r\n\r\nThis doesn't fully handle everything we want yet - for one thing, there's no scaling of the coordinates that works for gradients. Also, in Grid.jl @timholy added specializations for dimensions 1-4 that avoided splatting. I'd like to see if it's possible to do this using staged functions instead of explicitly writing them out, but this might not be fully performant yet. It also needs documentation.\r\n\r\nHowever, if anyone has any opinions about the API, this is as good a time as any to raise them.\r\n\r\nTodo:\r\n\r\n* [x] basic implementation\r\n* [x] gradient evaluation\r\n* [x] make sure it works with `DimSpec`s and `NoInterp` dimensions\r\n* [x] tests for combinations with `extrapolate` (both `extrapolate(scale(...))` and `scale(extrapolate(...))`)\r\n* [x] make sure scaled interpolation objects display nicely\r\n* [x] documentation","created_at":"2015-07-20T17:05:19Z","updated_at":"2015-09-21T09:37:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c4e22bc7cac70cf44a880b8f9731e8d728792e8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/47/commits","review_comments_url":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/47/comments","review_comment_url":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tlycken/Interpolations.jl/issues/47/comments","statuses_url":"https://api.github.com/repos/tlycken/Interpolations.jl/statuses/6e0235b649c51184e714192462440df979842847","head":{"label":"tlycken:scaling","ref":"scaling","sha":"6e0235b649c51184e714192462440df979842847","user":{"login":"tlycken","id":1550920,"avatar_url":"https://avatars.githubusercontent.com/u/1550920?v=3","gravatar_id":"","url":"https://api.github.com/users/tlycken","html_url":"https://github.com/tlycken","followers_url":"https://api.github.com/users/tlycken/followers","following_url":"https://api.github.com/users/tlycken/following{/other_user}","gists_url":"https://api.github.com/users/tlycken/gists{/gist_id}","starred_url":"https://api.github.com/users/tlycken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlycken/subscriptions","organizations_url":"https://api.github.com/users/tlycken/orgs","repos_url":"https://api.github.com/users/tlycken/repos","events_url":"https://api.github.com/users/tlycken/events{/privacy}","received_events_url":"https://api.github.com/users/tlycken/received_events","type":"User","site_admin":false},"repo":{"id":23384417,"name":"Interpolations.jl","full_name":"tlycken/Interpolations.jl","owner":{"login":"tlycken","id":1550920,"avatar_url":"https://avatars.githubusercontent.com/u/1550920?v=3","gravatar_id":"","url":"https://api.github.com/users/tlycken","html_url":"https://github.com/tlycken","followers_url":"https://api.github.com/users/tlycken/followers","following_url":"https://api.github.com/users/tlycken/following{/other_user}","gists_url":"https://api.github.com/users/tlycken/gists{/gist_id}","starred_url":"https://api.github.com/users/tlycken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlycken/subscriptions","organizations_url":"https://api.github.com/users/tlycken/orgs","repos_url":"https://api.github.com/users/tlycken/repos","events_url":"https://api.github.com/users/tlycken/events{/privacy}","received_events_url":"https://api.github.com/users/tlycken/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tlycken/Interpolations.jl","description":"B-spline interpolation in Julia","fork":false,"url":"https://api.github.com/repos/tlycken/Interpolations.jl","forks_url":"https://api.github.com/repos/tlycken/Interpolations.jl/forks","keys_url":"https://api.github.com/repos/tlycken/Interpolations.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tlycken/Interpolations.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tlycken/Interpolations.jl/teams","hooks_url":"https://api.github.com/repos/tlycken/Interpolations.jl/hooks","issue_events_url":"https://api.github.com/repos/tlycken/Interpolations.jl/issues/events{/number}","events_url":"https://api.github.com/repos/tlycken/Interpolations.jl/events","assignees_url":"https://api.github.com/repos/tlycken/Interpolations.jl/assignees{/user}","branches_url":"https://api.github.com/repos/tlycken/Interpolations.jl/branches{/branch}","tags_url":"https://api.github.com/repos/tlycken/Interpolations.jl/tags","blobs_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tlycken/Interpolations.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/tlycken/Interpolations.jl/languages","stargazers_url":"https://api.github.com/repos/tlycken/Interpolations.jl/stargazers","contributors_url":"https://api.github.com/repos/tlycken/Interpolations.jl/contributors","subscribers_url":"https://api.github.com/repos/tlycken/Interpolations.jl/subscribers","subscription_url":"https://api.github.com/repos/tlycken/Interpolations.jl/subscription","commits_url":"https://api.github.com/repos/tlycken/Interpolations.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/tlycken/Interpolations.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/tlycken/Interpolations.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/tlycken/Interpolations.jl/contents/{+path}","compare_url":"https://api.github.com/repos/tlycken/Interpolations.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tlycken/Interpolations.jl/merges","archive_url":"https://api.github.com/repos/tlycken/Interpolations.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tlycken/Interpolations.jl/downloads","issues_url":"https://api.github.com/repos/tlycken/Interpolations.jl/issues{/number}","pulls_url":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/tlycken/Interpolations.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/tlycken/Interpolations.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tlycken/Interpolations.jl/labels{/name}","releases_url":"https://api.github.com/repos/tlycken/Interpolations.jl/releases{/id}","created_at":"2014-08-27T09:36:22Z","updated_at":"2015-09-19T12:17:57Z","pushed_at":"2015-09-21T06:04:23Z","git_url":"git://github.com/tlycken/Interpolations.jl.git","ssh_url":"git@github.com:tlycken/Interpolations.jl.git","clone_url":"https://github.com/tlycken/Interpolations.jl.git","svn_url":"https://github.com/tlycken/Interpolations.jl","homepage":"","size":3450,"stargazers_count":18,"watchers_count":18,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":16,"forks":6,"open_issues":16,"watchers":18,"default_branch":"master"}},"base":{"label":"tlycken:master","ref":"master","sha":"3d73d1db905205004d32b4f4d3c843eb9e2980f3","user":{"login":"tlycken","id":1550920,"avatar_url":"https://avatars.githubusercontent.com/u/1550920?v=3","gravatar_id":"","url":"https://api.github.com/users/tlycken","html_url":"https://github.com/tlycken","followers_url":"https://api.github.com/users/tlycken/followers","following_url":"https://api.github.com/users/tlycken/following{/other_user}","gists_url":"https://api.github.com/users/tlycken/gists{/gist_id}","starred_url":"https://api.github.com/users/tlycken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlycken/subscriptions","organizations_url":"https://api.github.com/users/tlycken/orgs","repos_url":"https://api.github.com/users/tlycken/repos","events_url":"https://api.github.com/users/tlycken/events{/privacy}","received_events_url":"https://api.github.com/users/tlycken/received_events","type":"User","site_admin":false},"repo":{"id":23384417,"name":"Interpolations.jl","full_name":"tlycken/Interpolations.jl","owner":{"login":"tlycken","id":1550920,"avatar_url":"https://avatars.githubusercontent.com/u/1550920?v=3","gravatar_id":"","url":"https://api.github.com/users/tlycken","html_url":"https://github.com/tlycken","followers_url":"https://api.github.com/users/tlycken/followers","following_url":"https://api.github.com/users/tlycken/following{/other_user}","gists_url":"https://api.github.com/users/tlycken/gists{/gist_id}","starred_url":"https://api.github.com/users/tlycken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlycken/subscriptions","organizations_url":"https://api.github.com/users/tlycken/orgs","repos_url":"https://api.github.com/users/tlycken/repos","events_url":"https://api.github.com/users/tlycken/events{/privacy}","received_events_url":"https://api.github.com/users/tlycken/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tlycken/Interpolations.jl","description":"B-spline interpolation in Julia","fork":false,"url":"https://api.github.com/repos/tlycken/Interpolations.jl","forks_url":"https://api.github.com/repos/tlycken/Interpolations.jl/forks","keys_url":"https://api.github.com/repos/tlycken/Interpolations.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tlycken/Interpolations.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tlycken/Interpolations.jl/teams","hooks_url":"https://api.github.com/repos/tlycken/Interpolations.jl/hooks","issue_events_url":"https://api.github.com/repos/tlycken/Interpolations.jl/issues/events{/number}","events_url":"https://api.github.com/repos/tlycken/Interpolations.jl/events","assignees_url":"https://api.github.com/repos/tlycken/Interpolations.jl/assignees{/user}","branches_url":"https://api.github.com/repos/tlycken/Interpolations.jl/branches{/branch}","tags_url":"https://api.github.com/repos/tlycken/Interpolations.jl/tags","blobs_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tlycken/Interpolations.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/tlycken/Interpolations.jl/languages","stargazers_url":"https://api.github.com/repos/tlycken/Interpolations.jl/stargazers","contributors_url":"https://api.github.com/repos/tlycken/Interpolations.jl/contributors","subscribers_url":"https://api.github.com/repos/tlycken/Interpolations.jl/subscribers","subscription_url":"https://api.github.com/repos/tlycken/Interpolations.jl/subscription","commits_url":"https://api.github.com/repos/tlycken/Interpolations.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/tlycken/Interpolations.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/tlycken/Interpolations.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/tlycken/Interpolations.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/tlycken/Interpolations.jl/contents/{+path}","compare_url":"https://api.github.com/repos/tlycken/Interpolations.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tlycken/Interpolations.jl/merges","archive_url":"https://api.github.com/repos/tlycken/Interpolations.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tlycken/Interpolations.jl/downloads","issues_url":"https://api.github.com/repos/tlycken/Interpolations.jl/issues{/number}","pulls_url":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/tlycken/Interpolations.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/tlycken/Interpolations.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tlycken/Interpolations.jl/labels{/name}","releases_url":"https://api.github.com/repos/tlycken/Interpolations.jl/releases{/id}","created_at":"2014-08-27T09:36:22Z","updated_at":"2015-09-19T12:17:57Z","pushed_at":"2015-09-21T06:04:23Z","git_url":"git://github.com/tlycken/Interpolations.jl.git","ssh_url":"git@github.com:tlycken/Interpolations.jl.git","clone_url":"https://github.com/tlycken/Interpolations.jl.git","svn_url":"https://github.com/tlycken/Interpolations.jl","homepage":"","size":3450,"stargazers_count":18,"watchers_count":18,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":16,"forks":6,"open_issues":16,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/47"},"html":{"href":"https://github.com/tlycken/Interpolations.jl/pull/47"},"issue":{"href":"https://api.github.com/repos/tlycken/Interpolations.jl/issues/47"},"comments":{"href":"https://api.github.com/repos/tlycken/Interpolations.jl/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tlycken/Interpolations.jl/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/tlycken/Interpolations.jl/statuses/6e0235b649c51184e714192462440df979842847"}}}}