bijx.FreeTheoryScaling¶
- class bijx.FreeTheoryScaling[source]¶
Bases:
SpectrumScaling
Scaling bijection mapping white noise to free field theory.
Implements the momentum-space scaling transformation that converts Gaussian white noise into samples from a free scalar field theory.
Type: \(\mathbb{R}^{H \times W \times C} \to \mathbb{R}^{H \times W \times C}\)
Transform:
\[ \mathcal{F}^{-1}\left[\frac{1}{\sqrt{m^2 + \mathbf{k}^2}} \mathcal{F}[\xi]\right] \]For a free scalar field with mass \(m\), the two-point correlation function in momentum space is
\[ \langle\tilde{\phi}(\mathbf{k})\tilde{\phi}^*(\mathbf{k}')\rangle = \frac{\delta(\mathbf{k}-\mathbf{k}')}{m^2 + \mathbf{k}^2}\,. \]- Parameters:
m2 (
float
|Variable
) – Mass squared parameter (can be learnable nnx.Variable).space_shape (
tuple
[int
,...
]) – Spatial lattice dimensions.channel_dim (
int
) – Number of channel dimensions.finite_size (
bool
) – Whether to use lattice momenta (True) or continuum (False).precompute_spectrum (
bool
) – Whether to precompute scaling factors.half (
bool
) – Whether to use factor of 1/2 conventional in the action.
Note
Assumes periodic boundary conditions.
Example
>>> # Free scalar field with mass m=0.1 on 32x32 lattice >>> m2 = 0.01 >>> scaling = FreeTheoryScaling( ... m2, space_shape=(32, 32), finite_size=True ... ) >>> phi, log_det = scaling.forward(eps, log_density) # eps ~ N(0,1)
- __init__(m2, space_shape, channel_dim=0, finite_size=True, precompute_spectrum=True, half=True)[source]¶
- Parameters:
m2 (float | Variable)
space_shape (tuple[int, ...])
channel_dim (int)
finite_size (bool)
precompute_spectrum (bool)
half (bool)
Methods
apply
(x, log_density[, reverse])Unified transformation method.
forward
(x, log_density, **kwargs)Apply forward transformation.
invert
()Create an inverted version of this bijection.
reverse
(x, log_density, **kwargs)Apply reverse (inverse) transformation.
scale
(r[, reverse])Apply Fourier-space scaling transformation.
spectrum_function
(ks, m2)Compute free field scaling factors from momenta and mass.
Attributes
Multiplicative factor in Fourier space.
- spectrum_function(ks, m2)[source]¶
Compute free field scaling factors from momenta and mass.
- Parameters:
ks – Momentum grid with shape (…, spatial_dim).
m2 – Mass squared parameter.
- Returns:
Scaling factors for free field theory propagator.
- property scaling¶
Multiplicative factor in Fourier space.