Skip to content

Parametric smoothing interpolation #397

Description

@yakir12

Describe the bug 🐞

Interpolating a smoothing B-spline on parametric data errors.

Expected behavior

I had expected it to work just as interpolating a parametric data set works for non smoothing interpolation.

Minimal Reproducible Example 👇

using StaticArrays, DataInterpolations
n = 10
t = Float64.(1:n)
u = rand(SVector{2, Float64}, n)
LinearInterpolation(u, t) # works!

BSplineApprox(u, t, 2, 3, :Uniform, :Uniform) # errors!

Error & Stacktrace ⚠️

ERROR: MethodError: no method matching ^(::SVector{2, Float64}, ::Int64)
The function `^` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  ^(::Irrational{:ℯ}, ::Integer)
   @ Base mathconstants.jl:139
  ^(::ForwardDiff.Dual{Tx}, ::Integer) where Tx
   @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/dual.jl:148
  ^(::Float32, ::Integer)
   @ Base math.jl:1228
  ...

Stacktrace:
 [1] literal_pow
   @ ./intfuncs.jl:389 [inlined]
 [2] BSplineApprox(u::Vector{…}, t::Vector{…}, d::Int64, h::Int64, pVecType::Symbol, knotVecType::Symbol; extrapolation::DataInterpolations.ExtrapolationType.T, extrapolation_left::DataInterpolations.ExtrapolationType.T, extrapolation_right::DataInterpolations.ExtrapolationType.T, assume_linear_t::Float64)
   @ DataInterpolations ~/.julia/packages/DataInterpolations/r3oVa/src/interpolation_caches.jl:989
 [3] BSplineApprox(u::Vector{SVector{2, Float64}}, t::Vector{Float64}, d::Int64, h::Int64, pVecType::Symbol, knotVecType::Symbol)
   @ DataInterpolations ~/.julia/packages/DataInterpolations/r3oVa/src/interpolation_caches.jl:971
 [4] top-level scope
   @ REPL[13]:1
Some type information was truncated. Use `show(err)` to see complete types.

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
Status `/tmp/jl_HwR3uf/Project.toml`
  [82cc6244] DataInterpolations v7.2.0
  [90137ffa] StaticArrays v1.9.12
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Status `/tmp/jl_HwR3uf/Manifest.toml`
  [bbf7d656] CommonSubexpressions v0.3.1
  [a8cc5b0e] Crayons v4.1.1
  [9a962f9c] DataAPI v1.16.0
  [82cc6244] DataInterpolations v7.2.0
  [e2d170a0] DataValueInterfaces v1.0.0
  [163ba53b] DiffResults v1.1.0
  [b552c78f] DiffRules v1.15.1
  [ffbed154] DocStringExtensions v0.9.3
  [4e289a0a] EnumX v1.0.4
  [64ca27bc] FindFirstFunctions v1.4.1
  [f6369f11] ForwardDiff v0.10.38
  [92d709cd] IrrationalConstants v0.2.4
  [82899510] IteratorInterfaceExtensions v1.0.0
  [692b3bcd] JLLWrappers v1.7.0
  [b964fa9f] LaTeXStrings v1.4.0
  [2ab3a3ac] LogExpFunctions v0.3.29
  [1914dd2f] MacroTools v0.5.15
  [77ba4419] NaNMath v1.1.2
  [bac558e1] OrderedCollections v1.8.0
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [08abe8d2] PrettyTables v2.4.0
  [3cdcf5f2] RecipesBase v1.3.4
  [189a3867] Reexport v1.2.2
  [276daf66] SpecialFunctions v2.5.0
  [90137ffa] StaticArrays v1.9.12
  [1e83bf80] StaticArraysCore v1.4.3
  [892a3eda] StringManipulation v0.4.1
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.12.0
  [efe28fd5] OpenSpecFun_jll v0.5.6+0
  [56f22d72] Artifacts v1.11.0
  [2a0f44e3] Base64 v1.11.0
  [ade2ca70] Dates v1.11.0
  [76f85450] LibGit2 v1.11.0
  [8f399da3] Libdl v1.11.0
  [37e2e46d] LinearAlgebra v1.11.0
  [d6f4376e] Markdown v1.11.0
  [ca575930] NetworkOptions v1.2.0
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [fa267f1f] TOML v1.0.3
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [e37daf67] LibGit2_jll v1.7.2+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.6+0
  [4536629a] OpenBLAS_jll v0.3.27+1
  [05823500] OpenLibm_jll v0.8.1+2
  [8e850b90] libblastrampoline_jll v5.11.0+0
  • Output of versioninfo()
Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × AMD Ryzen Threadripper 2950X 16-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver1)
Threads: 32 default, 0 interactive, 16 GC (on 32 virtual cores)

Additional context

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions