Fix BSpline eval_unstructured for multi-dimensional interpolation #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
eval_unstructuredwas failing for multi-dimensional BSpline/NURBS interpolationeval_unstructuredProblem
The
eval_unstructuredfunction was throwing aBoundsErrorwhen used with multi-dimensional BSpline interpolation (e.g., 2D or higher). For example:Root Cause
In
eval_kernel, wheneval_grid=false,@index(Global, NTuple)returns a 1-tuple (e.g.,(1,)). This was passed directly to_interpolate!asmulti_point_index. However, the BSplineget_basis_function_valuesmethod for tuples expects an N_in-tuple and tries to accessmulti_point_index[dim_in]for all dimensions, causing a bounds error whendim_in > 1.Fix
Convert the 1-tuple to a scalar using
only(k)before passing to_interpolate!wheneval_grid=false. This ensures the correct method dispatch:Number→ unstructured evaluation methodTest plan
eval_unstructuredeval_unstructuredwith BigFloateval_unstructuredInterface Compatibility Check
This PR also checked interface compatibility:
similar(),zero(),one()correctly)synchronizeforJLBackendin JLArrays (this is a JLArrays issue, not DataInterpolationsND)cc @ChrisRackauckas
🤖 Generated with Claude Code