You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support for unequal numbers of points per dimension
Desired Behavior / Functionality
Torchquad currently only supports equal numbers of points per dimension for the deterministic methods (that use integration_grid.py). The user might want to use more points in one dimension than the others (if, for instance, the integration domain in one dimension is much larger than in the others or the function is more complex in certain dimensions).
Exactly how this should be implemented can be a bit up the contributor - perhaps the ideal solution is allowing many different types of input (see below).
What Needs to Be Done
Under torchquad.integration_grid.py, we have the following comment # TODO Add that N can be different for each dimension.
Currently, what happens is that the number of sample points per dimension (self._N) is set to the _n_th root of the total number of sample points, N, where n is the number of dimensions. self._N = int(N ** (1.0 / self._dim) + 1e-8) # convert to points per dim (the 1e-8 term here is explained in the code).
It would be nice to allow self_N to be for instance [16, 2, 2] instead of [4, 4, 4].
One solution could be to do the following:
If N is an integer, then let self._N be the _n_th root of N.
If N is a list/array, then let self._N be the list/array.
Note: For Monte Carlo and VEGAS, varying the number of points per dimension doesn't make sense.
How Can It Be Tested
A good place to start is to check if the tests fail, in particular the integration_grid_test.py.
Ideally, additional tests should be added to integration_grid_test.py.
The text was updated successfully, but these errors were encountered:
Support for unequal numbers of points per dimension
Desired Behavior / Functionality
Torchquad currently only supports equal numbers of points per dimension for the deterministic methods (that use integration_grid.py). The user might want to use more points in one dimension than the others (if, for instance, the integration domain in one dimension is much larger than in the others or the function is more complex in certain dimensions).
Exactly how this should be implemented can be a bit up the contributor - perhaps the ideal solution is allowing many different types of input (see below).
What Needs to Be Done
Under
torchquad.integration_grid.py
, we have the following comment# TODO Add that N can be different for each dimension
.Currently, what happens is that the number of sample points per dimension (
self._N
) is set to the _n_th root of the total number of sample points, N, where n is the number of dimensions.self._N = int(N ** (1.0 / self._dim) + 1e-8) # convert to points per dim
(the 1e-8 term here is explained in the code).It would be nice to allow
self_N
to be for instance[16, 2, 2]
instead of[4, 4, 4]
.One solution could be to do the following:
If N is an integer, then let
self._N
be the _n_th root of N.If N is a list/array, then let
self._N
be the list/array.Note: For Monte Carlo and VEGAS, varying the number of points per dimension doesn't make sense.
How Can It Be Tested
A good place to start is to check if the tests fail, in particular the integration_grid_test.py.
Ideally, additional tests should be added to integration_grid_test.py.
The text was updated successfully, but these errors were encountered: