-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
LinearInterpolation: Fix scalar indexing and generalize for ndims(u) > 2 #335
LinearInterpolation: Fix scalar indexing and generalize for ndims(u) > 2 #335
Conversation
What is the context? Any MWE for this? |
Yes, the current implementation fails on GPU. I also realized we can generalize
|
There is one breaking change here. The output of LinearInterpolation in case of
This was a vector before. But since we disallowed scalar indexing, the slope for an This would fail the interpolation tests for 2d matrices. |
Run the formatter |
This indeed broke my package extension tests in SparseConnectivityTracer.
Is this now inconsistent across AbstractInterpolations? |
Related issue: #328 |
That should now be consistent? |
No, as described by @ashutosh-b-b, julia> u = rand(5, 5)
5×5 Matrix{Float64}:
0.668608 0.874591 0.971824 0.878126 0.413327
0.291351 0.0898619 0.000914161 0.299064 0.936915
0.359392 0.67281 0.0165996 0.519808 0.130723
0.0474623 0.902087 0.216814 0.691552 0.118745
0.271747 0.846124 0.937015 0.815366 0.257844
julia> t = 0:4
0:4
julia> ConstantInterpolation(u, t)(1.0)
5-element Vector{Float64}:
0.8745907971604465
0.08986185939550206
0.6728097691137314
0.9020867050011258
0.8461239822546711
julia> LinearInterpolation(u, t)(1.0)
5×1 Matrix{Float64}:
0.8745907971604465
0.08986185939550206
0.6728097691137314
0.9020867050011258
0.8461239822546711
julia> QuadraticInterpolation(u, t)(1.0)
5-element Vector{Float64}:
0.8745907971604465
0.08986185939550206
0.6728097691137314
0.9020867050011258
0.8461239822546711 |
Oh wait, you weren't talking about an array of matrices input? Or higher order tensor? |
This PR makes interpolations inconsistent in the sense that For SCT and #328, I would like to be able to tell the state dimensionality from the type. |
That should definitely be a |
Yeah, to get a matrix, we can always do |
@sathvikbhagavan can you handle it? |
I have a potential fix open: #339 . x[:, idx+ 1] - x[:, idx]
# became
x[: , (idx + 1):(idx+1)] - x[:, idx:idx] Which prompted the |
Nice! I will tackle #328 |
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.