utils.integrands.volume module

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

Bases: utils.integrands.volume.VolumeIntegrand, utils.integrands.abstract.KnownIntegrand

Characteristic function of an hyperrectangle defined by cutting the unit hypercube along one axis. Its characteristic inequality is x[i] <= frac where 0. < frac < 1.

Parameters
  • d (int) –

  • split_dim (int) –

  • frac (float) –

inequality(x)[source]

Check if we are in the hyperrectangle

integral()[source]

The integral is the length of the non-unit side of the hyperrectangle

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

Bases: utils.integrands.volume.VolumeIntegrand, utils.integrands.abstract.KnownIntegrand

Characteristic function of an hypersphere. The hypersphere must fit in the unit hypercube fully

Parameters
  • d (int) –

  • r (float) –

  • c (torch.Tensor or float) –

inequality(x)[source]

Check if the points are in the hypersphere

integral()[source]

Compute the volume of the hypersphere in d dimensions

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

Bases: utils.integrands.abstract.RegulatedKnownIntegrand, utils.integrands.volume.HypersphereVolumeIntegrand

Characteristic function of an hypersphere with a small regulating factor. The hypersphere must fit in the unit hypercube fully

Parameters
  • d (int) –

  • r (float) –

  • c (torch.Tensor or float) –

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

Bases: utils.integrands.abstract.KnownIntegrand

Camel function consisting of the sum of two regulated hyperspherical volume functions with centers at (0.25, …, 0.25) and (0.75, …, 0.75)

evaluate_integrand(x)[source]

Compute the value of the integrand on a batch of points

integral()[source]

Compute the true value of the integral

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

Bases: utils.integrands.volume.RegulatedHyperSphericalCamel

Camel function consisting of the sum of two regulated hyperspherical volume functions with centers at (0.25, …, 0.25) and (0.75, …, 0.75) with identical radii

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

Bases: utils.integrands.abstract.Integrand, better_abc.ABC

Abstract class to define integrands that are 1 on a characteristic subspace and 0 outside, defined through an inequality f(x) >= 0

evaluate_integrand(x)[source]

Compute the value of the integrand on a batch of points by checking their inequality :param x: :type x: torch.Tensor

Returns

Return type

torch.Tensor

abstract inequality(x)[source]

The characteristic inequality of the volume we want to measure

Parameters

x (torch.Tensor) –

Returns

Return type

torch.BoolTensor