EllipsoidDomain#

class EllipsoidDomain(ellipsoid_dict, sample_surface=False)[source]

Bases: Location

PINA implementation of Ellipsoid domain.

PINA implementation of Ellipsoid domain.

Parameters:
  • ellipsoid_dict (dict) – A dictionary with dict-key a string representing the input variables for the pinn, and dict-value a list with the domain extrema.

  • sample_surface (bool) – A variable for choosing sample strategies. If sample_surface=True only samples on the ellipsoid surface frontier are taken. If sample_surface=False only samples on the ellipsoid interior are taken, defaults to False.

Warning

Sampling for dimensions greater or equal to 10 could result in a shrinking of the ellipsoid, which degrades the quality of the samples. For dimensions higher than 10, other algorithms for sampling should be used, such as: Dezert, Jean, and Christian Musso. “An efficient method for generating points uniformly distributed in hyperellipsoids.” Proceedings of the Workshop on Estimation, Tracking and Fusion: A Tribute to Yaakov Bar-Shalom. Vol. 7. No. 8. 2001.

Example:
>>> spatial_domain = Ellipsoid({'x':[-1, 1], 'y':[-1,1]})
property variables

Spatial variables.

Returns:

Spatial variables defined in ‘__init__()’

Return type:

list[str]

is_inside(point, check_border=False)[source]

Check if a point is inside the ellipsoid domain.

Note

When sample_surface in the __init()__ is set to True, then the method only checks points on the surface, and not inside the domain.

Parameters:
  • point (LabelTensor) – Point to be checked.

  • check_border (bool) – Check if the point is also on the frontier of the ellipsoid, default False.

Returns:

Returning True if the point is inside, False otherwise.

Return type:

bool

sample(n, mode='random', variables='all')[source]

Sample routine.

Parameters:
  • n (int) – Number of points to sample in the shape.

  • mode (str) – Mode for sampling, defaults to random. Available modes include: random.

  • variables (str | list[str]) – Variables to be sampled, defaults to all.

Returns:

Returns LabelTensor of n sampled points.

Return type:

LabelTensor

Example:
>>> elips = Ellipsoid({'x':[1, 0], 'y':1})
>>> elips.sample(n=6)
    tensor([[0.4872, 1.0000],
            [0.2977, 1.0000],
            [0.0422, 1.0000],
            [0.6431, 1.0000],
            [0.7272, 1.0000],
            [0.8326, 1.0000]])