Skip to content
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

refactor: add output dimensionality as a parameter in AbstractInterpolations #342

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

sathvikbhagavan
Copy link
Member

@sathvikbhagavan sathvikbhagavan commented Oct 7, 2024

fixes: #328

@sathvikbhagavan sathvikbhagavan marked this pull request as draft October 7, 2024 06:52
@sathvikbhagavan sathvikbhagavan marked this pull request as ready for review October 9, 2024 07:06
@sathvikbhagavan sathvikbhagavan force-pushed the sb/output_dim branch 2 times, most recently from 6ab798f to 59ada74 Compare October 9, 2024 22:00
@ChrisRackauckas ChrisRackauckas merged commit 97f00b6 into SciML:master Oct 11, 2024
10 checks passed
Comment on lines +67 to +73
function get_output_dim(u::AbstractVector)
return (length(first(u)),)
end

function get_output_dim(u::AbstractArray)
return size(u)[1:(end - 1)]
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sathvikbhagavan @ChrisRackauckas This breaks type inference of the constructors which causes problems in my downstream package (see #389). One way around this would be to allow (require?) users to specify the dimension as a type parameter when constructing the interpolation method.

However, it's not clear to me why this type parameter should be included at all. Arguably it also doesn't make sense at all for nonnumeric types (that I actually encounter when working with ConstantInterpolation). Would it be OK to revert this change?

If the output dimension is actually of interest to someone then it seems easy enough for them to use the logic of get_output_dim directly. Possibly this could also be made official by adding something like output_dim to the API (if actually necessary). This could also e.g. error for non-numeric types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indicate output dimensionality in AbstractInterpolation type
3 participants