Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

funeval error with Smolyak basis #45

Open
isutoris opened this issue Dec 6, 2017 · 0 comments · May be fixed by #46
Open

funeval error with Smolyak basis #45

isutoris opened this issue Dec 6, 2017 · 0 comments · May be fixed by #46
Assignees
Labels

Comments

@isutoris
Copy link

isutoris commented Dec 6, 2017

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.

@sglyon sglyon added the bug label Dec 6, 2017
@sglyon sglyon self-assigned this Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants