-
-
Notifications
You must be signed in to change notification settings - Fork 6
Generalise _interpolate! to allow mixed dimensions
#33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
_interpolate! to allow mixed dimensions_interpolate! to allow mixed dimensions
SouthEndMusic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully onderstand everything yet, but overall it looks good. I added some comments.
|
FYI there is a lot left to do, the tests that pass are because there are no missing dimensions but this will break if there are any. |
|
This should be working now. |
|
There are a few outstanding questions not - like #38 on what dimensions the weights matrix should have now. But more importantly, what should Currently Please chime in here this should be finalised and tested in this PR. |
src/interpolation_methods.jl
Outdated
| for (t₁, t₂) in zip(tᵢ, tᵢ₊₁) | ||
| t_vol *= t₂ - t₁ | ||
| out, valid_derivative_orders = check_derivative_order(interp_dims, derivative_orders, ts, out) | ||
| valid_derivative_orders || return out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be more clear that !valid_derivative_orders does not mean that the input is invalid but that it is certain that the output is 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you suggest
src/interpolation_methods.jl
Outdated
| out::Union{Number, AbstractArray{<:Any, N_out}}, | ||
| A::NDInterpolation{N, N_in, N_out}, | ||
| ts::Tuple{Vararg{Any, N}}, | ||
| idx::Tuple{Vararg{Any ,N}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why allow the index to be any type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be Colon() etc for NoInterpolationDimension.
Although this could all be cleaned up a bit.
Why not support multiple approaches? Have one method which calls |
|
Maybe, I was leaning to choosing one or the other because mixed tuple lengths both accepted in the same function may invite some user error and confusion. |
|
I am still in favor of supporting multiple options if reasonably possible. We could make the difference more explicit by using different functions or pass an optional Boolean flag. Then we still have to decide what the default behavior is. From a mathematical perspective I would prefer the current approach on main, but if passing some trivial object for the non-interpolated dimensions makes more sense from a code perspective, that's fine too. |
|
A bool keyword on a tuple length isn't necessarily type stable unless it reliably constant props, and I would prefer simplicity over options, so making a choice either way seems better to me. Given this difference of perspective its probably better discussed in a new PR and not hold up this one, so I kept the behavior as it was on main. |
|
This seems good to go to me. I don't think its even a breaking change? I have some performance improvements too but will PR those when this lands. (Please use squash if/when this is merged, there are a lot of small commits not intended for the history) |
This PR is an exploration of #31 and #32 to see whats possible.
Probably quite slow in current form but this largely works already for the current tests.The idea is to break each dimension into a preparation step, a definition of the iteration space, and then scaling and index generation functions for the inner loop, then call all of these function from the same shared
_interpolate!method.Will need to add some tests for mixed dimension types.Closes #31 and closes #32