sample_points {volesti} | R Documentation |
Sample uniformly or normally distributed points from a convex Polytope (H-polytope, V-polytope, zonotope or intersection of two V-polytopes).
Description
Sample n points with uniform or multidimensional spherical gaussian -with a mode at any point- as the target distribution.
Usage
sample_points(P, n, random_walk = NULL, distribution = NULL)
Arguments
P |
A convex polytope. It is an object from class (a) Hpolytope or (b) Vpolytope or (c) Zonotope or (d) VpolytopeIntersection. |
n |
The number of points that the function is going to sample from the convex polytope. |
random_walk |
Optional. A list that declares the random walk and some related parameters as follows:
|
distribution |
Optional. A list that declares the target density and some related parameters as follows:
|
Value
A d\times n
matrix that contains, column-wise, the sampled points from the convex polytope P.
Examples
# uniform distribution from the 3d unit cube in H-representation using ball walk
P = gen_cube(3, 'H')
points = sample_points(P, n = 100, random_walk = list("walk" = "BaW", "walk_length" = 5))
# gaussian distribution from the 2d unit simplex in H-representation with variance = 2
A = matrix(c(-1,0,0,-1,1,1), ncol=2, nrow=3, byrow=TRUE)
b = c(0,0,1)
P = Hpolytope(A = A, b = b)
points = sample_points(P, n = 100, distribution = list("density" = "gaussian", "variance" = 2))
# uniform points from the boundary of a 2-dimensional random H-polytope
P = gen_rand_hpoly(2,20)
points = sample_points(P, n = 100, random_walk = list("walk" = "BRDHR"))