Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/halton.lattice.r
Constructs a lattice of Halton boxes (a Halton lattice) inside a rectangular box.
1 2 3 4 5 6 7 8 |
box |
A DX2 matrix containing coordinates of the box.
One row per dimension. Column 1 is the minimum, column 2 is the maximum.
|
N |
Approximate number of points to place in the whole box. If |
J |
A DX1 vector of base powers which determines the size and shape
of the Halton boxes. Elements of |
eta |
A DX1 vector of the number of points to add inside each Halton box.
e.g., if |
triangular |
boolean, if TRUE, construct a triangular grid.
If FALSE, construct rectangular grid. See help for |
bases |
A DX1 vector of Halton bases. These must be co-prime. |
This is designed to be called with the bounding box of a spatial object. See examples.
Definition of Halton lattice: A Halton lattice has the same number
of points in every Halton box. Halton boxes are the bases[1]^J[1]
X
bases[2]^J[2]
matrix of rectangles over a square. Each Halton box
contains prod(eta)
points.
A data frame containing coordinates in the Halton lattice.
Names of the coordinates are dimnames(box)[1]
. If box
does not
have dimnames, names of the coordinates are c("d1", "d2", ...)
(d1 is
horizontal, d2 is vertical, etc).
In addition, return has following attributes:
J
: the J
vector used to construct the lattice.
This is either the input J
or the computed J
when
only N
is specified.
eta
: the eta
vector used in the lattice.
bases
: Bases of the van der Corput sequences used in the lattice,
one per dimension.
triangular
: Whether the lattice is triangular or square.
hl.bbox
: The input box
. If box
does not
have dimnames, this attribute will be assigned dimnames of
list(c("d1","d2"),c("min","max"))
.
Trent McDonald
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Lattice of 2^3*3^2 = 72 points in unit box
hl <- halton.lattice( J=c(3,2) )
# Plot
hl.J <- attr(hl,"J")
hl.b <- attr(hl,"bases")
hl.bb <- attr(hl,"hl.bbox")
plot( hl.bb[1,], hl.bb[2,], type="n", pty="s")
points( hl[,1], hl[,2], pch=16, cex=.75, col="red")
for(d in 1:ncol(hl)){
tmp2 <- hl.bb[d,1] + (0:(hl.b[d]^hl.J[d]))*(diff(hl.bb[d,]))/(hl.b[d]^hl.J[d])
if( d == 1){
abline(v=tmp2)
} else{
abline(h=tmp2)
}
}
# Lattice of approx 1000 points over bounding box of spatial object
hl <- halton.lattice( bbox(HI.coast), N=1000 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.