quantax.nn.input_to_index#

quantax.nn.input_to_index(s: Array) → Array#

Convert a \(\pm 1\) configuration into a per-unit-cell state index.

The occupations of all sites (and spin species) within a unit cell are packed into the bits of a single integer, giving one index per cell in [0, 1 << s_per_cell), where s_per_cell is the number of binary degrees of freedom in a cell (lattice.shape[0] for spin, twice that for spinful fermions).

Parameters:

s – The configuration, a \(\pm 1\) array of length Nsites (spin or spinless fermion) or 2 * Nsites (spinful fermion, ordered as spin-up sites then spin-down).

Returns:

An integer array with one entry per unit cell, i.e. of length prod(lattice.shape[1:]).