Fix BSpline eval_unstructured for multi-dimensional interpolation#52
Merged
ChrisRackauckas merged 2 commits intoJul 5, 2026
Merged
Conversation
6df42fc to
c830c0c
Compare
The eval_unstructured function was failing for BSpline interpolation with more than one dimension because the multi_point_index was being passed as a 1-tuple (e.g., (i,)) instead of a scalar. The issue was in eval_kernel: when eval_grid=false, @index(Global, NTuple) returns a 1-tuple, but the get_basis_function_values method for BSpline expects either: - A scalar Number for unstructured evaluation - An N_in-tuple for grid evaluation The fix converts the 1-tuple to a scalar using only(k) before passing to _interpolate! when eval_grid=false. Also adds regression tests for: - BSpline 2D eval_unstructured - BSpline eval_unstructured with BigFloat - NURBS eval_unstructured 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
c830c0c to
cad2d62
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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