QuantEcon / QuantEcon/BasisMatrices.jl

BUG: funeval returns a 0 dimensional array when BasisStructure has single point

Open
#16 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
33
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Issue by spencerlyon2
Friday Jul 31, 2015 at 02:16 GMT
Originally opened as https://github.com/QuantEcon/CompEcon.jl/issues/10


Test case:

using CompEcon
basis = Basis(ChebParams(10, -1, 1), ChebParams(5, 2, 4));
grid = nodes(basis)[1];
y = grid[:, 1] - grid[:, 2];  # simple function x - y
c = funfitxy(basis, grid, y)[1];
pt = [0.5, 2.1];
bs = BasisStructure(basis, Direct(), pt);
funeval(c, bs)

REPL example:

julia> using CompEcon

julia> basis = Basis(ChebParams(10, -1, 1), ChebParams(5, 2, 4));


julia> grid = nodes(basis)[1];

julia> y = grid[:, 1] - grid[:, 2];  # simple function x - y

julia> c = funfitxy(basis, grid, y)[1];

julia> pt = [0.5, 2.1];

julia> bs = BasisStructure(basis, Direct(), pt);

julia> funeval(c, bs)
0-dimensional Array{Float64,0}:
-1.6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the Julia reproduction with BasisStructure(basis, Direct(), pt), then trace the funeval entry point and the Direct basis evaluation path. Check how the single-point result is shaped and add or update a regression test for this case. Done means the shown evaluation no longer returns a 0-dimensional array.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.