Skip to contents

Closures mapping between the parameter space and a coordinate space, with the coordinate constraints stated so a constrained optimiser (SLSQP) can run on the set.

Usage

chart(space)

Arguments

space

A convex_region.

Value

A list comprising:

n_par

dimension of the coordinate space.

to_theta(u)

maps coordinates to the parameter vector.

to_theta_batch(u_mat)

(N, n_par) coordinates, one point per row, to (N, d) parameters.

from_theta(theta)

Coordinates for a point in the parameter space, satisfying the constraints.

jacobian(u)

(d, n_par) derivative of to_theta at u.

lower

length-n_par lower bounds on the coordinates; -Inf where a coordinate is free.

heq(u), heqjac(u)

equality constraint (heq(u) = 0 on the feasible set) and its Jacobian, or NULL when there is none.

seed(n)

(n, n_par) random feasible coordinates, one point per row, for a multi-start search, drawn to suit the space's own geometry.

Examples

# One part of the K = 3 plurality null: `theta_1 <= theta_2` in the simplex.
s <- simplex_region(vertices = rbind(c(0.5, 0.5, 0), c(0, 1, 0), c(0, 0, 1)))
ch <- chart(s)
ch$n_par
#> [1] 3

# Coordinates are barycentric weights over the three vertices ...
ch$to_theta(c(1 / 2, 1 / 4, 1 / 4))
#> [1] 0.25 0.50 0.25
ch$from_theta(c(0.1, 0.6, 0.3))
#> [1] 0.2 0.5 0.3

# ... constrained to the simplex.
ch$lower
#> [1] 0 0 0
ch$heq(c(1 / 2, 1 / 4, 1 / 4))
#> [1] 0

# An unbounded region also has lineality and cone coordinates. The halfspace
# `{theta_1 <= theta_2}` has one on its bounding hyperplane and one for the
# distance inward, the latter bounded below:
ch <- chart(halfspace_region(normal = c(1, -1), offset = 0))
ch$lower
#> [1] -Inf    0
ch$to_theta(c(0, sqrt(2)))
#> [1] -1  1