QuantEcon / CompEcon.jl

Julia versions of the CompEcon routines by Miranda and Fackler.
BSD 3-Clause "New" or "Revised" License
47 stars 27 forks source link

BUG: BasisStructure constructor not working #9

Closed sglyon closed 9 years ago

sglyon commented 9 years ago

If you have a Basis{N} N>1 and you try to construct a BasisStructure at a single point, you cannot represent that point as a Vector{Float64} of length N.

Test case to reproduce:

julia> using CompEcon

julia> basis = Basis(ChebParams(10, -1, 1), ChebParams(5, 2, 4))
2 dimensional Basis on the hypercube formed by [-1.0,2.0] × [1.0,4.0].
Basis families are CompEcon.Cheb × CompEcon.Cheb

julia> pt = [0.5, 2.1]
2-element Array{Float64,1}:
 0.5
 2.1

julia> BasisStructure(basis, Direct(), pt)
ERROR: BoundsError: attempt to access 2-element Array{Float64,1}:
 0.5
 2.1
  at index [Colon(),2]
 in throw_boundserror at abstractarray.jl:155
 in call at /Users/sglyon/.julia/v0.4/CompEcon/src/basis_structure.jl:160
 in call at /Users/sglyon/.julia/v0.4/CompEcon/src/basis_structure.jl:142

julia> BasisStructure(basis, Direct(), pt')
BasisStructure{CompEcon.Direct} of order [0 0]