Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow support of unequal numbers of points per dimension #123

Open
htoftevaag opened this issue Aug 20, 2021 · 0 comments
Open

Allow support of unequal numbers of points per dimension #123

htoftevaag opened this issue Aug 20, 2021 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@htoftevaag
Copy link
Collaborator

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.

@htoftevaag htoftevaag added enhancement New feature or request help wanted Extra attention is needed labels Aug 20, 2021
@gomezzz gomezzz mentioned this issue Dec 16, 2021
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant