jipolanco / BSplineKit.jl

A collection of B-spline tools in Julia
https://jipolanco.github.io/BSplineKit.jl/dev/
MIT License
50 stars 9 forks source link

MethodError: no method matching LinearAlgebra.LU #58

Closed sjkobayashi closed 1 year ago

sjkobayashi commented 1 year ago

Hi. I'm using Julia version 1.8.5, and I encountered the following error when precompiling the latest version of the package.

ERROR: LoadError: MethodError: no method matching LinearAlgebra.LU(::BSplineKit.Collocation.CollocationMatrix{Float64, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}, ::Vector{Int64}, ::Int64)
Closest candidates are:
  LinearAlgebra.LU(::AbstractMatrix{T}, ::AbstractVector{<:Integer}, ::Int32) where T at /usr/local/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/LinearAlgebra/src/lu.jl:60
Stacktrace:
  [1] lu!(C::BSplineKit.Collocation.CollocationMatrix{Float64, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}, ::LinearAlgebra.NoPivot; check::Bool)
    @ BSplineKit.Collocation ~/.julia/packages/BSplineKit/jjwCD/src/Collocation/matrix.jl:101
  [2] lu!(C::BSplineKit.Collocation.CollocationMatrix{Float64, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}, ::LinearAlgebra.NoPivot) (repeats 2 times)
    @ BSplineKit.Collocation ~/.julia/packages/BSplineKit/jjwCD/src/Collocation/matrix.jl:86
  [3] _factorise!(C::BSplineKit.Collocation.CollocationMatrix{Float64, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}})
    @ BSplineKit.SplineInterpolations ~/.julia/packages/BSplineKit/jjwCD/src/SplineInterpolations/SplineInterpolations.jl:90
  [4] BSplineKit.SplineInterpolations.SplineInterpolation(#unused#::UndefInitializer, B::BSplineKit.BSplines.BSplineBasis{3, Float64, Vector{Float64}}, x::Vector{Float64}, #unused#::Type{Float64})
    @ BSplineKit.SplineInterpolations ~/.julia/packages/BSplineKit/jjwCD/src/SplineInterpolations/SplineInterpolations.jl:86
  [5] interpolate(x::Vector{Float64}, y::Vector{Float64}, k::BSplineKit.BSplines.BSplineOrder{3}, bc::Nothing)
    @ BSplineKit.SplineInterpolations ~/.julia/packages/BSplineKit/jjwCD/src/SplineInterpolations/SplineInterpolations.jl:237
  [6] interpolate(x::Vector{Float64}, y::Vector{Float64}, k::BSplineKit.BSplines.BSplineOrder{3})
    @ BSplineKit.SplineInterpolations ~/.julia/packages/BSplineKit/jjwCD/src/SplineInterpolations/SplineInterpolations.jl:230
  [7] macro expansion
    @ ~/.julia/packages/BSplineKit/jjwCD/src/BSplineKit.jl:55 [inlined]
  [8] macro expansion
    @ ~/.julia/packages/SnoopPrecompile/1XXT1/src/SnoopPrecompile.jl:62 [inlined]
  [9] macro expansion
    @ ~/.julia/packages/BSplineKit/jjwCD/src/BSplineKit.jl:48 [inlined]
 [10] top-level scope
    @ ~/.julia/packages/SnoopPrecompile/1XXT1/src/SnoopPrecompile.jl:119 [inlined]
 [11] top-level scope
    @ ~/.julia/packages/BSplineKit/jjwCD/src/BSplineKit.jl:0
 [12] include
    @ ./Base.jl:419 [inlined]
 [13] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1554
 [14] top-level scope
    @ stdin:1
jipolanco commented 1 year ago

Thanks, I had a similar issue at some point, but I haven't been able to reproduce it. For now I guess I'll disable precompilation of the failing methods.

jipolanco commented 1 year ago

Let me know if you still see this issue after upgrading to BSplineKit 0.14.4.

sjkobayashi commented 1 year ago

Thanks for looking into this, but I still encounter a similar error when evaluating the example code:

xdata = (0:10).^2  # points don't need to be uniformly distributed
ydata = rand(length(xdata))
itp = interpolate(xdata, ydata, BSplineOrder(4))

Here is the error:

ERROR: MethodError: no method matching LinearAlgebra.LU(::CollocationMatrix{Float64, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}, ::Vector{Int64}, ::Int64)
Closest candidates are:
  LinearAlgebra.LU(::AbstractMatrix{T}, ::AbstractVector{<:Integer}, ::Int32) where T at /usr/local/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/LinearAlgebra/src/lu.jl:60
Stacktrace:
 [1] lu!(C::CollocationMatrix{Float64, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}, ::LinearAlgebra.NoPivot; check::Bool)
   @ BSplineKit.Collocation ~/.julia/packages/BSplineKit/ilFpN/src/Collocation/matrix.jl:101
 [2] lu!(C::CollocationMatrix{Float64, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}, ::LinearAlgebra.NoPivot) (repeats 2 times)
   @ BSplineKit.Collocation ~/.julia/packages/BSplineKit/ilFpN/src/Collocation/matrix.jl:86
 [3] _factorise!(C::CollocationMatrix{Float64, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}})
   @ BSplineKit.SplineInterpolations ~/.julia/packages/BSplineKit/ilFpN/src/SplineInterpolations/SplineInterpolations.jl:90
 [4] SplineInterpolation(#unused#::UndefInitializer, B::BSplineBasis{4, Float64, Vector{Float64}}, x::Vector{Int64}, #unused#::Type{Float64})
   @ BSplineKit.SplineInterpolations ~/.julia/packages/BSplineKit/ilFpN/src/SplineInterpolations/SplineInterpolations.jl:86
 [5] interpolate(x::Vector{Int64}, y::Vector{Float64}, k::BSplineOrder{4}, bc::Nothing)
   @ BSplineKit.SplineInterpolations ~/.julia/packages/BSplineKit/ilFpN/src/SplineInterpolations/SplineInterpolations.jl:237
 [6] interpolate(x::Vector{Int64}, y::Vector{Float64}, k::BSplineOrder{4})
   @ BSplineKit.SplineInterpolations ~/.julia/packages/BSplineKit/ilFpN/src/SplineInterpolations/SplineInterpolations.jl:230
 [7] top-level scope
   @ REPL[5]:1
jipolanco commented 1 year ago

I see... I think the issue is that on your machine LinearAlgebra.BlasInt is an Int32, while BSplineKit assumes Int64. I'll push a proper fix for this.

sjkobayashi commented 1 year ago

Thank you! It works now.