PointDiscretizedBoxMap
A generalization of MonteCarloBoxMap
and GridBoxMap
can be defined as follows:
- we provide a "global" set of test points within the unit cube $[-1,1]^d$.
- For each box
Box(c,r)
, we rescale the global test points to lie within the box by calculatingc .+ r .* p
for each global test pointp
.
GAIO.PointDiscretizedBoxMap
— FunctionBoxMap(:pointdiscretized, map, domain, points) -> SampledBoxMap
Construct a SampledBoxMap
that uses the iterator points
as test points. points
must be an array or iterator of test points within the unit cube [-1,1]^N
.
BoxMap(:pointdiscretized, :simd, map, domain, points) -> CPUSampledBoxMap
Construct a CPUSampledBoxMap
that uses the iterator points
as test points. points
must have eltype SVector{N, SIMD.Vec{S,T}}
and be within the unit cube [-1,1]^N
.
BoxMap(:pointdiscretized, :gpu, map, domain::Box{N}, points) -> GPUSampledBoxMap
Construct a GPUSampledBoxMap
that uses the Vector points
as test points. points
must be a VECTOR of test points within the unit cube [-1,1]^N
.
Requires a CUDA-capable gpu.
Example
julia> using StaticArrays # create a map that tests the vertices of a box
julia> global_test_points = SVector{2,Float64}[ (1, 1), (1, -1), (-1, 1), (-1, -1) ]
4-element Vector{SVector{2, Float64}}: [1.0, 1.0] [1.0, -1.0] [-1.0, 1.0] [-1.0, -1.0]
julia> F = BoxMap(:pointdiscretized, f, domain, global_test_points)
SampledBoxMap with 4 sample points
julia> p = plot!( p, F(B), color=RGBA(1.,0.,0.,0.5), lab="Images of test points along the vertices" )
Plot{Plots.GRBackend() n=4}