Homeotopy

A library for creating some standard homeomorphisms.

This library is based around a set of Topologies. Calling homeomorphism with two Topologies creates a homeomorphism from one topology to the other. Topoligies should specify their domains, but where unspecified, the topoligies try to conform to a reasonable standard domain. The homeomorphism should work for closed set elements too, but thos elements may not be bijective.

Remarks

It’s probably important to note that floating point numbers are not real numbers, and so none of these are really bijective at all.

Also note that this library does not define homeotopies. It’s just named this have to “py” in the name.

class homeotopy.Ball(p: float)

Bases: Topology

The topology of the p-norm ball.

This represents all points in R^n s.t. ||x||_p < 1, although it should also work fo the boundary.

from_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points from the inf-ball to this topology.

Parameters:

points ((..., d_in)) – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points on the boarder should be handled as well.

Returns:

points – A set of points in the topological space.

Return type:

(…, d_out)

p: float
to_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points in this topology to the inf-ball.

Parameters:

points ((..., d_in)) – A set of points in the input topological space

Returns:

points – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points can be mapped to the border for border points in the source topology.

Return type:

(…, d_out)

class homeotopy.Cube

Bases: Topology

The topology of the unit hyper cube.

This represents all points in R^n s.t 0 < x_i < 1, although the boundary should also work.

from_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points from the inf-ball to this topology.

Parameters:

points ((..., d_in)) – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points on the boarder should be handled as well.

Returns:

points – A set of points in the topological space.

Return type:

(…, d_out)

to_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points in this topology to the inf-ball.

Parameters:

points ((..., d_in)) – A set of points in the input topological space

Returns:

points – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points can be mapped to the border for border points in the source topology.

Return type:

(…, d_out)

class homeotopy.Homeomorphism(source: Topology, target: Topology)

Bases: object

A homeomorphism from source to target.

Homeomorphisms can be called on points in the source domain to map them to points in the target domain. They can also be inverted to create the inverse mapping.

Example

from homeotopy import homeomorphism, ball, simplex import numpy as np

forward = homeomorphism(ball(1), simplex()) backward = ~forward

ball_points = … simplex_points = forwad(ball_points) backward(simplex_points)

source: Topology
target: Topology
class homeotopy.Plane

Bases: Topology

The topology of the euclidian plane.

This represents all points in R^n, but boundary points map to inf.

Remarks

While translations will keep all points valid, this will try to keep points at the “center” of the space mapped to (0, 0, …, 0).

from_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points from the inf-ball to this topology.

Parameters:

points ((..., d_in)) – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points on the boarder should be handled as well.

Returns:

points – A set of points in the topological space.

Return type:

(…, d_out)

to_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points in this topology to the inf-ball.

Parameters:

points ((..., d_in)) – A set of points in the input topological space

Returns:

points – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points can be mapped to the border for border points in the source topology.

Return type:

(…, d_out)

class homeotopy.Simplex

Bases: Topology

The topology of the simplex.

This represents all points in R^n s.t. 0 < x_i and Σx_i = 1.

from_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points from the inf-ball to this topology.

Parameters:

points ((..., d_in)) – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points on the boarder should be handled as well.

Returns:

points – A set of points in the topological space.

Return type:

(…, d_out)

to_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points in this topology to the inf-ball.

Parameters:

points ((..., d_in)) – A set of points in the input topological space

Returns:

points – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points can be mapped to the border for border points in the source topology.

Return type:

(…, d_out)

class homeotopy.Sphere

Bases: Topology

The topology of the unit sphere.

This represents all points in R^n s.t. ||x||_2 = 1, except for the point (1, 0, …, 0). That point is considered the boundary of the space, and will be mapped the largest closed point in some other topologies.

Remarks

If you had points on the surface of another p-ball, you could use the ball homeomorphism to first map them onto the surface of the 2-ball, and then apply this homeomorphism.

from_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points from the inf-ball to this topology.

Parameters:

points ((..., d_in)) – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points on the boarder should be handled as well.

Returns:

points – A set of points in the topological space.

Return type:

(…, d_out)

to_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points in this topology to the inf-ball.

Parameters:

points ((..., d_in)) – A set of points in the input topological space

Returns:

points – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points can be mapped to the border for border points in the source topology.

Return type:

(…, d_out)

class homeotopy.Topology

Bases: ABC

An abstract topological space.

For this library to work, each Topologiy should define a homeomorphism from it to the inf-norm ball.

Remarks

to_inf_ball and from_inf_ball are not meant to be called in isolation, but rather used in combination with homeomorphism.

abstract from_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points from the inf-ball to this topology.

Parameters:

points ((..., d_in)) – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points on the boarder should be handled as well.

Returns:

points – A set of points in the topological space.

Return type:

(…, d_out)

abstract to_inf_ball(points: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Map a set of points in this topology to the inf-ball.

Parameters:

points ((..., d_in)) – A set of points in the input topological space

Returns:

points – A set of points in the inf-norm ball, e.g. -1 < x_i < 1 for points in the open topology, but points can be mapped to the border for border points in the source topology.

Return type:

(…, d_out)

homeotopy.ball(p: float = 2.0) Ball

Create a topology of the interior of the p-norm unit ball.

homeotopy.cube() Cube

Create a topology of the unit cube.

homeotopy.homeomorphism(source: Topology, target: Topology) Homeomorphism

Create a Homeomorphism from a source and a target topology.

homeotopy.plane() Plane

Create a topology of the euclidian plane.

homeotopy.simplex() Simplex

Create the topology of the simplex.

homeotopy.sphere() Sphere

Create a topology fot the unit sphere.

Indices and tables