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

Make points lazy #531

Open
dlfivefifty opened this issue Sep 8, 2017 · 5 comments
Open

Make points lazy #531

dlfivefifty opened this issue Sep 8, 2017 · 5 comments

Comments

@dlfivefifty
Copy link
Member

That is, return an AbstractVector.

This has the benefit that we can do fast transforms like:

x = points(Chebyshev(),100) # Returns `ChebyshevPoints`
f = Fun(exp)
f.(x)  # use transform, not evaluation by overloading `broadcast(f::Fun{<:Chebyshev}, x::ChebyshevPoints)`

While we are at it, each point should be stored in angle variables?

struct CosPoint{T} <: Real
   θ::T
end

convert(::Type{T}, x::CosPoint) = convert(T, cos(x.θ))

Then f(x::CosPoint) would no longer be numerically unstable.

@dlfivefifty
Copy link
Member Author

Supporting mapped domains is a complication here. I think for that we need to resolve

#133

@dlfivefifty
Copy link
Member Author

Also, maybe points -> grid to avoid confusion with Point?

@dlfivefifty
Copy link
Member Author

I think we just have

struct MappedGrid{MAP, GRID, T} <: AbstractVector{T}
   op::MAP
   grid::GRID
end

also, grids should have domains. Then one can do

@inline default_broadcast(f, A, Bs...) = Base.Broadcast.broadcast_c(f, containertype(A, Bs...), A, Bs...)

function broadcast(f::Fun{S}, grid::Grid{D}) where S<:Space{D} where D
  if domain(f) == domain(grid) && length(grid)  ncoefficients(f)  # otherwise would need clever aliasing
    values(pad(f, length(grid)))
  else
     default_broadcast(f, grid)
  end
end

@dlfivefifty
Copy link
Member Author

Probably better to support hasfasttransform(f::Fun, x::Grid)

@dlfivefifty
Copy link
Member Author

This would also allow for "value-spaces" as PointSpace(ChebyshevGrid(n)), etc.

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