QuantEcon / SimpleDifferentialOperators.jl

Library for simple upwind finite differences
MIT License
12 stars 2 forks source link

Attempt at a jump interface for the ExtensionOperators #157

Closed jlperla closed 5 years ago

jlperla commented 5 years ago

right now, an array of Integer, eventually enables an array of discretized pmf.

struct JumpProcess{T} where T <: AbstractArray jumps::T end

(Resolved by af7005f and 5b132bf)
- [x] Constructor for two different approaches.  Pre-calculated from the extension.  In both cases forcing the boundary width to be 1 on each sides.

function JumpProcess(x̄::AbstractArray; jumps::AbstractArray, truncate = (:interior,:interior)) # array of Integer compatible values @assert length(x̄) == length(jumps) + 2 i.e. every point except boundaries

truncate the jumps as required the interior vs. exterior bounds at 0 vs. 1 or M vs. M+1

 return new JumpProcess(jumps)

end

(Resolved by d76f525)
- [x] Version with the function

function JumpProcess(x̄::AbstractArray; jumps::Function, truncate = (:interior,:interior))

Fill in the jumps array by calling jumpfunction at every x in the interior of x̄ and finding the closest value in x̄.

 return new JumpProcess(jumpsarray)

end

(Resolved by baae1d8)
- [x] Test the `:interior` vs. `:boundary` for both sides.
(Resolved by d76f525)
- [x] Generate as a banded.

JumpProcess.jumps bands = - min(jumps), max(jumps) # or something like this.


(Resolved by c0bb687)
- [x]  Add in convenience constructors for constant jumps.  Two overloads: an integer for the jump steps and an `<: Real` for the rounding based on the `x_bar`.
(Resolved by 6ac68fa)
- [x] Add up docstrings stuff (Resolved by 93dc4fc)

~For all of this: only do the uniform grid specializations.~ Implementation complete for irregular grids as well (see unit tests for confirmation)