funeval error with Smolyak basis

Aperta
#45 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@sglyon ci sta già lavorando.

Dal 6/12/2017.

  • #46 di @sglyon — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

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.

Lingua principale
Julia
Stelle
33
Fork
20
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di QuantEcon/BasisMatrices.jl

Tutte le issue di QuantEcon/BasisMatrices.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.