bijx.lattice¶
Methods for manipulating lattice field configurations.
Includes both scalar and gauge fields, generally assuming periodic boundary conditions.
Functions
|
Roll lattice fields by specified displacement with periodic boundaries. |
- bijx.lattice.roll_lattice(lattice, loc, invert=False)[source]¶
Roll lattice fields by specified displacement with periodic boundaries.
Performs a cyclic shift of lattice data, treating leading dimensions as spatial coordinates and trailing dimensions as field components (“channels”).
The default behavior “rolls into position”: to access the field value originally at site \((x+\text{loc})\), access the rolled lattice at site \(x\).
- Parameters:
lattice – Lattice field array where leading dimensions correspond to spatial coordinates and trailing dimensions are field components.
loc – Displacement tuple specifying the shift in each spatial direction. Length must not exceed the number of spatial dimensions.
invert – If True, roll in the opposite direction (equivalent to accessing the field at \(x-\text{loc}\) when looking at site \(x\)).
- Returns:
Shifted lattice array with the same shape as input.
Example
>>> lattice = jnp.arange(16).reshape(4, 4) >>> shifted = roll_lattice(lattice, (0, 1)) >>> shifted[0, 0] == lattice[0, 1] Array(True, dtype=bool)