Learn R Programming

fellov (version 0.1)

wrangle_ellipse: Ellipse Wrangeler

Description

wrangle_ellipse is used to wrangle one or more ellipses from one parametrization to another.

Usage

wrangle_ellipse(ell, out_params = c("c", "P", "r"))

Arguments

ell

a list of (non degenerate) ellipses to be wrangled. An ellipse is a named list and each entry corresponds to a parameter. To ensure all out_params can be calculated one of the parametrizations listed below in the description must be specified. Some out_params do not require a fully parametrized ellipse and so partially specified ellipses can be used.

out_params

a vector of names of the output parameters. A list of possible parameters is given below in the details.

Value

A list of wrangled ellipses. The wrangled ellipses are now given by the out_params.

Details

Takes ellipse parameters and and calculates the wanted out_params. A parameterization is a named list, where each named entry is a parameter. The following parameters are accepted both input and output:

  • n : dimension of ellipse; an integer.

  • c : center of the ellipse; a vector.

  • P : precision matrix - inverse of S; a positive definit, symmetric matrix.

  • S : deviation matrix - inverse of P; a positive definit, symmetric matrix.

  • r : radius; a positive number.

  • q : cross term -Pc; a vector.

  • L : Cholesky decomposition of P

  • e : eigen values of P; a vector of eigenvalues.

  • U : eigen vectors of P; a matrix, where each column is an eigen vector.

  • D : diagnonal matrix with sqrt(e) as diagonal entries.

An ellipse E may be fully parameterized using the above parameters in the following ways:

To ensure that all of the above parameters can be calculated it is advised (but in some cases not needed) that the input ellipses are fully parameterized.

Examples

Run this code
# NOT RUN {
# two dimensional unite ball
e2d <- list(c = c(0,0), S = matrix(c(1,0,0,1), ncol = 2), r = 1)

# three dimensional ellipse
e3d <- list(c = c(3,2,1), P = matrix(c(3,1,2,1,5,0,2,0,2), ncol = 3))

f1 <- wrangle_ellipse(e2d) # (c,P,r) parameterization
f2 <- wrangle_ellipse(e2d, out_params = c("c", "e", "U", "r"))
f3 <- wrangle_ellipse(list("ellipse1" = e2d, "ellipse2" = e3d),
                      c("n", "c", "U", "D"))

# }

Run the code above in your browser using DataLab