Skip to content

funeval error with Smolyak basis #45

Description

@isutoris

I've noticed that the package has code for Smolyak interpolation, although I'm not sure if it's finished and supposed to be used. Anyway, it doesn't seem to work with funeval:

using BasisMatrices
parms = SmolyakParams(2,3,zeros(2),ones(2))
fspace = Basis(parms)
b = zeros(length(fspace))
x = [0.5, 0.5]
funeval(b, fspace, x)

yields an error:

ERROR: MethodError: Cannot `convert` an object of type Array{Float64,2} to an object of type BasisMatrices.SplineSparse{Float64,Int64,n_chunks,chunk_len} where chunk_len where n_chunks
This may have arisen from a call to the constructor BasisMatrices.SplineSparse{Float64,Int64,n_chunks,chunk_len} where chunk_len where n_chunks(...),
since type constructors fall back to convert methods.
Stacktrace:
 [1] BasisMatrices.BasisMatrix(::Type{BasisMatrices.SplineSparse}, ::BasisMatrices.Basis{1,Tuple{BasisMatrices.SmolyakParams{Float64,Int64}}}, ::BasisMatrices.Direct, ::Array{Float64,2}, ::Array{Int64,2}) at /home/ivansml/.julia/v0.6/BasisMatrices/src/basis_structure.jl:231
 [2] funeval(::Array{Float64,1}, ::BasisMatrices.Basis{1,Tuple{BasisMatrices.SmolyakParams{Float64,Int64}}}, ::Array{Float64,2}, ::Int64) at /home/ivansml/.julia/v0.6/BasisMatrices/src/interp.jl:197
 [3] funeval(::Array{Float64,1}, ::BasisMatrices.Basis{1,Tuple{BasisMatrices.SmolyakParams{Float64,Int64}}}, ::Array{Float64,1}, ::Int64) at /home/ivansml/.julia/v0.6/BasisMatrices/src/interp.jl:148 (repeats 2 times)

and funeval(b, fspace, x') (i.e. when x is 1 by 2 matrix) results in

ERROR: x must have d=1 columns
Stacktrace:
 [1] funeval(::Array{Float64,1}, ::BasisMatrices.Basis{1,Tuple{BasisMatrices.SmolyakParams{Float64,Int64}}}, ::Array{Float64,2}, ::Int64) at /home/ivansml/.julia/v0.6/BasisMatrices/src/interp.jl:188 (repeats 2 times)

The immediate cause seems to be that fspace here is of type Basis{1,...} (since it contains only one set of parameters) and thus the call is dispatched to methods intended for 1D basis structures.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions