utils.integrands.pretty module

Pretty, low dimensional examples where we clearly beat VEGAS

class CircleLineIntegrand(*args, **kwargs)[source]

Bases: utils.integrands.abstract.Integrand

Classic failure mode of VEGAS: function with an enhancement along a circle and a line on the diagonal, preventing a straightforward analytic change of variable

This is a generalization with a n-sphere and maximal diagonal pattern

evaluate_integrand(x)[source]

Compute the value function

Parameters

x (torch.Tensor) –

Returns

Return type

torch.Tensor

class SineIntegrand(*args, **kwargs)[source]

Bases: utils.integrands.abstract.Integrand

Sinusoidal function with a wave vector along the maximal hyperdiagonal

Parameters
  • f (float) – period of the sinus

  • offset (float) –

evaluate_integrand(x)[source]

Define a wave vector k with the dimensionality of x and all entries 1 and return cst+cos(f*k.x)

class SineLineIntegrand(*args, **kwargs)[source]

Bases: utils.integrands.abstract.Integrand

2D function enhanced on the graph y = sin(2*pi*f*x)

Parameters
  • sig (float) – thickness of the line

  • f (float) – period of the sinus

evaluate_integrand(x)[source]

Compute the integrand as a gaussian whose argument is the characteristic equation of the graph