Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special object to store discretized decision rule. #125

Open
albop opened this issue Dec 9, 2017 · 0 comments
Open

Special object to store discretized decision rule. #125

albop opened this issue Dec 9, 2017 · 0 comments

Comments

@albop
Copy link
Member

albop commented Dec 9, 2017

Currently we store the controls on the grid in any exogenous state i_m \in [0,N_m] as a Vector{ListOfPoints{d}} where the size of the vector is N_m and the size of each ListOfPoints is N.

Given an element $x \in Vector{ListOfPoints{d}}$, we tediously perform the following operations:
1/ compute error maxabs(x) which is the supremum norm over all the elements
2/ access i-th list of points x[i] isa ListOfPoints{d}
3/ convert to/from a flat vector

Last item is problematic: we make a copy of the data in x which is a shame. The question I'm asking there is whether we could have an object, whose data would be one single contiguous vector that could also be treated as a Vector of ListOfPoints.

There is at least one problem I foresee:

  • we currently use reinterpret a lot, which converts vectors into other vectors. If I'm not mistaken in >0.7, it would return an AbstractArray instead. So the natural approach would be to define x[ì] as a basic view over the data.* But we (I) have recently made the assumption everywhere that we are dealing with contiguous vectors. We'll have to reconsider, probably re-AbstractVectorize everything...

Some features that would be nice for this object:

  • not assume that all lists of points have the same length
  • not make precise assumption about the type of element. For instance it could work with Point{d} and Jacobian{d} as well (a square matrix).

I guess it should be possible to make something simple and robust here, so let's think it hard !

  • Something like:
struct StangeArray{T}
    data::Vector{T}
    views::Vector{ArrayView{T}}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant