Description Usage Arguments Details Value Examples
View source: R/wrangle_ellipse.R
wrangle_ellipse
is used to wrangle one or more ellipses from one
parametrization to another.
1 | wrangle_ellipse(ell, out_params = c("c", "P", "r"))
|
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 |
a vector of names of the output parameters. A list of possible parameters is given below in the 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.
A list of wrangled ellipses. The wrangled ellipses are now given by
the out_params
.
1 2 3 4 5 6 7 8 9 10 | # 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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.