N3PDF / vegasflow

VegasFlow: accelerating Monte Carlo simulation across multiple hardware platforms
https://vegasflow.readthedocs.io
Apache License 2.0
34 stars 9 forks source link

Specify integration limits #82

Closed scarlehoff closed 2 years ago

scarlehoff commented 2 years ago

This fixes #80

In order to use it the xmin and xmax keywords need to be used when instantiating the algorithm

from vegasflow import VegasFlow
import tensorflow as tf

def simple_integrand(xarr):
    return tf.reduce_prod(xarr, axis=1)

dims = 2
ncalls = int(1e4)
xmin = [0, 1]
xmax = [1.0, 4.0]
inst = VegasFlow(dims, ncalls, xmin=xmin, xmax=xmax)
inst.compile(simple_integrand)
result = inst.run_integration(5)

I need to give it a bit of testing to make sure that it works as it should but it should serve your use case @Mulliken

NominHanggai commented 2 years ago

Thanks for making this change @scarlehoff!