mt.geond.hyperellipsoid

There are many definitions of a hyperellipsoid. In our case, a hyperellipsoid is an affine transform of the unit hypersphere x^2+y^2+…=1.

Functions

mt.geond.hyperellipsoid.transform_Aff_on_Hyperellipsoid(aff_tfm, obj)

Affine-transforms a hyperellipsoid. The resultant Hyperellipsoid has affine transformation aff_tfm*obj.aff_tfm.

Parameters:
  • aff_tfm (Aff) – an affine transformation

  • obj (Hyperellipsoid) – a hyperellipsoid

Returns:

the affine-transformed hyperellipsoid

Return type:

Hyperellipsoid

Classes

  • Hyperellipsoid: Hyperellipsoid, defined as an affine transform the unit hypersphere x^2+y^2+z^2+…=1.

class mt.geond.hyperellipsoid.Hyperellipsoid(aff_tfm, make_normalised=True)

Hyperellipsoid, defined as an affine transform the unit hypersphere x^2+y^2+z^2+…=1.

If the unit hypersphere is parameterised by (cos(t_1), sin(t_1)*cos(t_2), sin(t_1)*sin(t_2)*cos(t_3), …) where t_1, t_2, … in [0,pi) but the last t_{dim-1} in [0,2pi) then the hyperellipsoid is parameterised by f0 + f1 cos(t_1) + f2 sin(t_1) cos(t_2) + f3 sin(t_1) sin(t_2) sin(t_3) cos(t_4) + …, where f0 is the bias vector, f1, f2, … are the columns of the weight matrix from left to right respectively, of the affine transformation. They are also called called axes of the hyperellipsoid.

Note that this representation is not unique, the same hyperellipsoid can be represented by an infinite number of affine transforms of the unit hypersphere. To make the representation more useful and more unique, we further assert that when the axes are perpendicular (linearly independent), the hyperellipsoid is normalised. In other words, the weight matrix is a unitary matrix multiplied by a diagonal matrix. After normalisation there can still be an infinite number of ways to represent the same hyperellipsoid, but only in singular cases. You can normalise either at initialisation time, or later by invoking member function normalised.

Parameters:
  • aff_tfm (Aff) – an affine transformation

  • make_normalised (bool) – whether or not to adjust the affine transformation to make a normalised representation of the hyperellipsoid

Examples

>>> import numpy as np
>>> from mt.geond.hyperellipsoid import Aff, Hyperellipsoid
>>> a = Aff(bias=np.array([2,3]), weight=np.diag([4,5]))
>>> e = Hyperellipsoid(a)
>>> e
Hyperellipsoid(aff_tfm=Aff(weight_diagonal=[0. 0.], bias=[2 3]))
>>> e.aff_tfm.matrix
array([[0., 4., 2.],
       [5., 0., 3.],
       [0., 0., 1.]])

Inheritance

digraph inheritancea931e34be0 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GeometricObject" [URL="../mt.geo/mt.geo.object.html#mt.geo.object.GeometricObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A geometric object which lives in a d-dimensional Euclidean space."]; "Hyperellipsoid" [URL="#mt.geond.hyperellipsoid.Hyperellipsoid",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Hyperellipsoid, defined as an affine transform the unit hypersphere x^2+y^2+z^2+...=1."]; "GeometricObject" -> "Hyperellipsoid" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
__init__(aff_tfm, make_normalised=True)

Initialises a hyperellipsoid with an affine transformation.

__repr__()

Return repr(self).

property ndim

Returns the number of dimensions in which the geometric object lives.

normalised()

Returns an equivalent hyperellipsoid where f1 and f2 are perpendicular (linearly independent).