GridBoxMap
Another naive but still useful approach is to place the test points on an equidistant grid within a box. This approach removes an element of randomness from the Monte-Carlo approach.
GAIO.GridBoxMap
— FunctionBoxMap(:grid, map, domain::Box{N}; n_points::NTuple{N} = ntuple(_->16, N)) -> SampledBoxMap
Construct a SampledBoxMap
that uses a grid of test points. The size of the grid is defined by n_points
, which is a tuple of length equal to the dimension of the domain.
BoxMap(:grid, :simd, map, domain::Box{N}; n_points::NTuple{N} = ntuple(_->16, N)) -> CPUSampledBoxMap
Construct a CPUSampledBoxMap
that uses a grid of test points. The size of the grid is defined by n_points
, which is a tuple of length equal to the dimension of the domain. The number of points is rounded up to the nearest mutiple of the cpu's SIMD capacity.
BoxMap(:grid, :gpu, map, domain::Box{N}; n_points::NTuple{N} = ntuple(_->16, N)) -> GPUSampledBoxMap
Construct a GPUSampledBoxMap
that uses a grid of test points. The size of the grid is defined by n_points
, which is a tuple of length equal to the dimension of the domain.
Requires a CUDA-capable gpu.
Example
julia> n_points = (8, 8)
(8, 8)
julia> F = BoxMap(:grid, f, domain, n_points = n_points)
SampledBoxMap with 64 sample points
julia> p = plot!( p, F(B), color=RGBA(0.,1.,0.,0.5), lab="$(join(n_points, "x")) grid of test points" )
Plot{Plots.GRBackend() n=4}