Comments (6)
@btengels great to see you here!
The only reason is that it hasn't been implemented.
For gridded interpolation there is a significant efficiency gain if we can cache the indices. The gain isn't as large with with cardinal ("vanilla") B-splines.
I have plans to implement vector evaluation for cardinal B-splines because you can actually get decent speedups if you make certain assumptions. One assumption is that you assume the points you want to evaluate at are sorted or otherwise close to one another. Then you can avoid a whole binary search across the vector by starting with a guess for the index at point i
being near the index at point i-1
.
from interpolations.jl.
With a Gridded
object, there's a big performance savings to vectorization, because you have to do a grid-lookup for each evaluation and you can effectively cache the results. With a plain BSpline
, there's no performance advantage in vectorization, and it seems that we were hoping to use julia's fallbacks: for most AbstractArray
types, you only have to write routines for scalar indexes, and julia takes care of the rest. However, that seems to require that the indexes are integers, which obviously doesn't work with Interpolations.
So, someone presumably needs to implement the vectorization within Interpolations. It should be pretty simple, e.g., the one-liner
getindex(itp, index1, index2) = [itp[i1,i2] for i1 in index1, i2 in index2]
work for 2d. But obviously it has to be done for arbitrary dimensionality (using generated functions, presumably).
from interpolations.jl.
If it can be done, I'd really like to "force" the vectorized fallbacks in Julia to become compatible with this* instead of implementing it here. For one thing, the code here is going to be very similar to the one in base Julia, and for another I think this package is a good use case for testing that the fallbacks become flexible enough to actually be useful.
There might be some perfomance optimizations for B-splines that are still possible after that, but I doubt that any of them are worth the added complexity, and I definitely think we should wait with implementing until we can measure that it's needed.
In the meantime, @btengels, I just do [J_itp[x,1] for x in linspace(1,2,10)]
manually whenever I need something like that.
*) although it's a little over my head to implement it, so I'm just hoping @timholy and @ mbauman (who doesn't need to be pinged here...) will sort it out 😄
For reference, see also #24, #54, #55, #96 for other discussions related to vector-valued evaluation.
from interpolations.jl.
*) although it's a little over my head to implement it, so I'm just hoping @timholy and @ mbauman (who doesn't need to be pinged here...) will sort it out 
We will. But it will only arrive in julia 0.5.
from interpolations.jl.
Not supporting itp[linspace(1,10,100), 3.5]
until Julia 0.5 arrives is fine by me - after all, it's really only nicer syntax for functionality that already exists in more verbose forms (list comprehensions). If others disagree strongly there might be merit in doing something about it, but MHO is that the added value isn't worth the added complexity. Interpolations.jl's source is already pretty complex as it is.
from interpolations.jl.
Closing this for housekeeping - feel free to re-open if there is more to discuss here.
from interpolations.jl.
Related Issues (20)
- Precompilation warnings HOT 3
- Documentation: what exactly is meant by "irregular grid"? HOT 1
- NaturalNeighbours.jl HOT 1
- `BoundsError` with Julia 1.10.0-beta1 HOT 2
- Interpolating 2D non-uniform Data HOT 1
- Interpolate a set of points HOT 1
- issue to remove
- Free(OnGrid()) boundary conditions produce surprising results HOT 4
- Documentation on GPU support HOT 6
- Interpolation bug when calling without extrapolate HOT 2
- CITATION.cff not generating options
- RFC: possible rework of element type and inferrability HOT 2
- Running examples in docs fails HOT 4
- Setup jldoctest
- Stable docs is pointing to 0.14.7 HOT 1
- Use abbreviated show methods HOT 1
- If raster contains a single NaN Linear() works but Cubic() returns all NaNs HOT 2
- Cubic spline interpolation for Vector Type x
- Is there a way to interpolate a 2d grid with missing values. HOT 1
- Scaled `Lanczos` interpolator throws `MethodError` regarding the `lbound()` function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from interpolations.jl.