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. Ifsample_surface=False
only samples on the ellipsoid interior are taken, defaults toFalse
.
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.
- 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 toTrue
, 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:
- sample(n, mode='random', variables='all')[source]
Sample routine.
- Parameters:
- Returns:
Returns
LabelTensor
of n sampled points.- Return type:
- 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]])