Skip to content

iNetwork

Base class for 1D tensor network unit cells with infinite boundaries.

iNetwork

iNetwork(
    tensors: List[Tensor],
    center: Optional[int] = None,
    itag_prefix: Optional[str] = None,
)

Base class for 1D tensor network unit cells with infinite boundaries.

Stores the N site tensors of one translation-invariant unit cell and provides uniform iteration, bond bookkeeping, and axis conventions. Subclasses add the per-type validation (iMPS, iMPO) and, for states, the gauge-fixing machinery.

Parameters:

Name Type Description Default
tensors List[Tensor]

Non-empty list of the unit cell's site tensors.

required
center Optional[int]

Orthogonality center site index, or None if the canonical form is unspecified.

None
itag_prefix Optional[str]

Bond itag prefix string. Defaults to '_init_' when None. Subclasses override this default ('A' for iMPS, 'W' for iMPO), so supply this argument only when a non-default prefix is explicitly required.

None

Raises:

Type Description
ValueError

If tensors is empty, or if the unit cell does not tile consistently.

Attributes

N property

N: int

Number of sites in the unit cell.

L property

L: int

Alias for N, for symmetry with the finite Network family.

bc instance-attribute

bc: str = 'IBC'

center property

center: Optional[int]

Orthogonality center site index, or None if unspecified.

Read-only. Set internally by the gauge-fixing routines.

bond_dims property

bond_dims: List[int]

Bond dimension at each bond of the unit cell (length N).

Entry i is the dimension of the right bond of site i. Entry N-1 is the bond onto the next copy of the cell, which is the same bond as the left bond of site 0 — note the length is N, not N-1 as in the finite case.

bond_states property

bond_states: List[int]

Number of physical states at each bond of the unit cell (length N).

Entry i is the state count of the right bond of site i. For Abelian symmetry groups this is identical to bond_dims; for generic groups (e.g. SU(2)) it is larger due to multiplet degeneracy: each multiplet of spin j contributes 2j+1 states.

phys_dims property

phys_dims: List[int]

Physical dimension at each site of the unit cell (axis 2, the ket index).

itag_prefix property writable

itag_prefix: str

Prefix string for bond itags produced by the gauge-fixing sweeps.

The left bond of site i is tagged {prefix}{i % N:0M} and the right bond is tagged {prefix}{(i+1) % N:0M}, where M is max(2, len(str(N))). Changing the prefix only affects future canonicalization calls; existing itags are not retroactively renamed.

Methods:

to

to(
    device: Optional[Union[str, device]] = None, dtype: Optional[dtype] = None
) -> None

Move every site tensor to device and cast it to dtype, in place.

Both arguments are optional and an omitted one leaves that aspect of the tensors alone. Casting the blocks also casts the Bridge intertwiner weights, which a generic symmetry group needs: the two must agree for the tensor to contract.

Parameters:

Name Type Description Default
device Optional[Union[str, device]]

Target device. If None, the current device is kept.

None
dtype Optional[dtype]

Target block dtype. If None, the current dtype is kept.

None

serialize

serialize() -> dict

Convert the unit cell to a plain dict compatible with torch.save.

The returned dict contains only Python primitives and torch.Tensor values, making it directly usable with torch.save / torch.load(..., weights_only=True).

Returns:

Type Description
dict

Serialized representation with keys "version", "class", "bc", "center", "itag_prefix", and "tensors".

deserialize staticmethod

deserialize(data: dict, device: str = 'cpu') -> iNetwork

Reconstruct an iNetwork (or subclass) from a dict from serialize.

Dispatches to the correct subclass (iNetwork, iMPS, or iMPO) based on the "class" key in data. The registry is separate from the finite one, so a finite payload cannot be loaded as an infinite network or the other way around.

Parameters:

Name Type Description Default
data dict

Dict previously produced by serialize.

required
device str

Device to place all tensor blocks on. Defaults to "cpu".

'cpu'

Returns:

Type Description
iNetwork

Reconstructed network on device. The concrete type matches what was serialized.

Raises:

Type Description
ValueError

If data["version"] is not 1, or if data["class"] names an unknown class.

Notes

The cell is cyclic: bond N is bond 0, and the constructor checks that the right index of each site matches the left index of the next, the last site meeting the first. bc is fixed to 'IBC' for the whole family, so code that dispatches on boundary conditions can treat finite and infinite networks alike.

Canonicalization does not live here, unlike in Network. An infinite cell has no end to sweep orthogonality in from, so the gauge is solved for and not swept, and iMPS carries that machinery alone. An iMPO is never canonicalized at all.

See Also

  • iMPS — infinite matrix product state (3-index site tensors).
  • iMPO — infinite matrix product operator (4-index site tensors).
  • Network — the finite counterpart.