funeval error with Smolyak basis

オープン
#45 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

@sglyon がすでに取り組んでいます。

2017年12月6日 から。

  • #46 @sglyon による — オープン

評価

この issue はまだ評価されていません。

説明

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.

主要言語
Julia
スター
33
フォーク
20
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

QuantEcon/BasisMatrices.jl のほかの issue

QuantEcon/BasisMatrices.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。