Constructors for S4 objects, containing a matrix (gv) and coordinates (x and y), or (xb and yb).
Essentially, the gv slot is equivalent to the matrix returned by base::outer, over the x and y values.
DGrid is for integer inputs and CGrid is for numeric inputs.
The StepGrid version is for step functions, where xb and yb represent breakpoints.
The gv values are evaluated using the midpoints.
The xgrid.hdim function and related functions, can be used to produce arrays in higher dimensions.
A suitable function.
It's first argument should be a matrix/list/etc, if cf provided, otherwise it should have leading arguments, for x and y.
xlim, ylim
Length-two integer (for DGrid) or numeric (for CGrid/SGrid) vectors.
These give the limits for the sequences.
n
Integer vector of length one or two, the number or rows and columns.
For CGrid, this is also the length of the x and y sequences.
For StepGrid, xb and yb will be one longer.
iterate
Logical, if true, evaluate the function with one bin/point, at a time.
Note that this is not done in an efficient way, you'll get a faster result if you vectorize your function.
cf
A function of two vectors, used to combine x and y into a single object.
The sf function is called using the result of the cf function.
x, y
Integer or numeric vectors.
xb, yb
Same as x and y, but one longer, for breakpoints/endpoints.
gv
A matrix of grid values, equivalent to the result of sf.
# NOT RUN {f <- function (v)
v [,1] + v [,2]
#simple addition problemdgrid (`+`, c (0, 4), c (1, 5) )
#same, but f operates on matrixdgrid (f, c (0, 4), c (1, 5), cf=cbind)
# }