polyh_rivols_gen and polyh_rivols_ineq generate iid samples from the intrinsic volumes distribution of polyhedral cones.

polyh_rivols_gen(n, A, solver = "nnls", reduce = TRUE, tol = 1e-07)

polyh_rivols_ineq(n, A, solver = "nnls", reduce = TRUE, tol = 1e-07)

Arguments

n

number of samples

A

matrix

solver

either "nnls" or "mosek"

reduce

logical; if TRUE, the cone defined by A will be decomposed orthogonally w.r.t. its lineality space

tol

tolerance used in the reduction step (single precision machine epsilon by default)

Value

The outputs of polyh_rivols_gen(n,A) and polyh_rivols_ineq(n,A), with the default value reduce==TRUE, are lists containing the following elements:

  • dimC: the dimension of the linear span of C,

  • linC: the lineality of the cone C,

  • QL: an orthogonal basis of the orthogonal complement of the linear span of C, set to NA if dim(C)==d,

  • QC: an orthogonal basis of the projection of C onto the orthogonal complement of the lineality space of C, set to NA if C is a linear space,

  • A_reduced: a matrix defining the reduced cone,

  • samples: an n-element vector of integers in linC,...,dimC representing iid samples from the distribution on {0,1,...,d} with the probability for k given by v_k(C), where either C={Ax|x>=0} or C={y|A^Ty<=0},

  • multsamp: a (d+1)-element vector of integers in 0,...,n that sum up to n representing the frequency table of the above categorical samples.

If reduce==FALSE then the output is a list containing only the vectors samples and multsamp.

Details

The samples are from the intrinsic volumes distribution, which is the distribution on {0,1,...,d} with the probability for k given by v_k(C), where C is the polyhedral cone given by the matrix A, either through its columns spanning the cone, C={Ax|x>=0}, or through its rows giving the inequalities of the cone, C={y|A^Ty<=0}. If reduce==TRUE (default), then a reduced form of the cone will be computed and returned; however, the intrinsic volumes distribution will be that of the original (non-reduced) cone.

Functions

  • polyh_rivols_gen: Interprets A as generator matrix of the cone, that is, the cone is given by {Ax|x>=0}; the matrix A_reduced defines the reduced cone in the same way.

  • polyh_rivols_ineq: Interprets A as inequality matrix of the cone, that is, the cone is given by {y|A^Ty<=0}; the matrix A_reduced defines the reduced cone in the same way.

Note

See this vignette for further info.

See also

Package: conivol

Examples

# using the 'generators' interpretation set.seed(1234) out_gen <- polyh_rivols_gen(20, matrix(1:12,4,3)) print(out_gen)
#> $dimC #> [1] 2 #> #> $linC #> [1] 0 #> #> $QL #> [1] NA #> #> $QC #> [,1] [,2] #> [1,] -0.4036176 -0.7328662 #> [2,] -0.4647441 -0.2898498 #> [3,] -0.5258707 0.1531666 #> [4,] -0.5869972 0.5961831 #> #> $A_reduced #> [,1] [,2] #> [1,] -5.258707 -21.1085440 #> [2,] 1.531666 -0.6552639 #> #> $samples #> [1] 2 0 0 1 1 1 2 0 1 1 0 1 1 0 1 0 1 1 1 1 #> #> $multsamp #> [1] 6 12 2 0 0 #>
set.seed(1234) out_gen$linC + polyh_rivols_gen(20, out_gen$A_reduced, solver="mosek", reduce=FALSE)$samples
#> [1] 2 0 0 1 1 1 2 0 1 1 0 1 1 0 1 0 1 1 1 1
# using the 'inequalities' interpretation set.seed(1234) out_ineq <- polyh_rivols_ineq(20, matrix(1:12,4,3)) print(out_ineq)
#> $dimC #> [1] 4 #> #> $linC #> [1] 2 #> #> $QL #> [1] NA #> #> $QC #> [,1] [,2] #> [1,] -0.4036176 -0.7328662 #> [2,] -0.4647441 -0.2898498 #> [3,] -0.5258707 0.1531666 #> [4,] -0.5869972 0.5961831 #> #> $A_reduced #> [,1] [,2] #> [1,] -5.258707 -21.1085440 #> [2,] 1.531666 -0.6552639 #> #> $samples #> [1] 2 4 4 3 3 3 2 4 3 3 4 3 3 4 3 4 3 3 3 3 #> #> $multsamp #> [1] 0 0 2 12 6 #>
set.seed(1234) out_ineq$linC + polyh_rivols_ineq(20, out_ineq$A_reduced, solver="mosek", reduce=FALSE)$samples
#> [1] 2 4 4 3 3 3 2 4 3 3 4 3 3 4 3 4 3 3 3 3