torchphysics.problem.domains.domainND package
Submodules
torchphysics.problem.domains.domainND.hypercube module
- class torchphysics.problem.domains.domainND.hypercube.HyperCube(space, lower_bounds, upper_bounds)[source]
Bases:
Domain
A n-dimensional cube for sampling parameters.
- Parameters:
space (Space) – The space of this object.
lower_bounds (float or array_like) – The lower bound for each dimension of this hypercube. If a single float is passed in, we assume that all dimensions have this value as a lower bound.
upper_bounds (float or array_like) – The upper bound for each dimension of this hypercube. If a single float is passed in, we assume that all dimensions have this value as an upper bound.
Note
This class is only meant for randomly sampling parameters in high dimensional spaces. Currently many functionalites of other domains are not supported in this class. This includes, calling .boundary, checking if points are contained in this HyperCube and also domain operations. Additionally, HyperCubes can not dependt on other parameters!
- sample_grid(n=None, d=None, params=Points: {}, device='cpu')[source]
Creates an equdistant grid in the domain.
- Parameters:
n (int, optional) – The number of points that should be created.
d (float, optional) – The density of points that should be created, if n is not defined.
params (torchphysics.problem.Points, optional) – Additional paramters that are maybe needed to evaluate the domain.
device (str) – The device on which the points should be created. Default is ‘cpu’.
- Returns:
A Points object containing the sampled points.
- Return type:
- sample_random_uniform(n=None, d=None, params=Points: {}, device='cpu')[source]
Creates random uniformly distributed points in the domain.
- Parameters:
n (int, optional) – The number of points that should be created.
d (float, optional) – The density of points that should be created, if n is not defined.
params (torchphysics.problem.Points, optional) – Additional paramters that are maybe needed to evaluate the domain.
device (str) – The device on which the points should be created. Default is ‘cpu’.
- Returns:
A Points object containing the sampled points.
- Return type: