# pgs-internal: Internal pgs functions In pgs: Precision of Geometric Sampling

## Description

Internal pgs functions. These functions should not be called by most users.

## Usage

 ```1 2 3 4 5 6 7 8``` ```cubicgrid(s,d=2) dualmat(x) gaic(a,x) in.upper.halfspace(x) normphase(h,E,Einv=solve(E)) pointcov(x,tol=.Machine\$double.eps ^ 0.5) sphereSurface(d=2) ellipsoidSurface(a) ```

## Arguments

 `s` a list of vectors or a vector. `d` an integer, the space dimension. Default: 2. `x` an array, a matrix or a vector. `a` a numeric. `h` a vector or a matrix. `E` a matrix. `Einv` a matrix. `tol` a numeric.

## Details

`cubicgrid` computes the coordinates of the points of the Cartesian product set s1 x...x sd where the si's are subsets of reals. The si's may be provided as a list of vectors or a vector `s`. In the latter case, the vector s is replicated d-times in the list list(s,...,s).

`dualmat` computes the dual of a non-singular square matrix `x`.

`gaic` computes the incomplete gamma function with parameter `a` for a vector or an array of reals `x`.

`in.upper.halfspace` is used to test if the vector `x` is in the upper half-space. Upper half-space: null vector or last non-zero coordinate is greater than 0.

`normphase` normalizes the vector `h` with respect to a vector lattice. The lattice is defined by its generating matrix `E`. The normalized vector lies inside the fundamental tile defined by `E` and differs from `h` by a lattice vector. When `h` is a matrix, the transformation is applied to each column vector.

`pointcov` computes the set S-S for a given finite set of points S. The points are defined as the columns of a matrix `x`. The result is given as a list with two components `ud` and `n`. The component `ud` contains the points of S-S lying in the upper half-space (S-S is symmetric). The component `n` provides multiplicities: `n[i]` is the multiplicity of `ud[,i]`. The parameter `tol` controls the precision level in comparisons.

`sphereSurface` computes the surface area of the unit sphere in the d-dimensional space.

`ellipsoidSurface` computes the surface area of an ellipsoid in a space of arbitrary dimension. The argument a is a vector containing the semi-axis lengths. The algorithm is based on Garry Tee (2005) Surface area and capacity of ellipsoids in n dimensions. New Zealand Journal of Mathematics, 34(2), 165–198. It involves numerical one-dimensional integration.

## Examples

 ```1 2 3 4 5 6 7 8``` ```cubicgrid(c(1,2,5)) dualmat(diag(1:2)) gaic(1.2,seq(0.5,10,length=10)) in.upper.halfspace(c(-1,0)) in.upper.halfspace(c(1,0)) normphase(c(1.8,1.5),diag(1:2)) pointcov(matrix(c(0,0,1,0,1,1,0,1,1/2,1/2),nrow=2)) sphereSurface(2) ```

pgs documentation built on May 29, 2017, 5:30 p.m.