nkdsl.KBodyIteratorSpec

class KBodyIteratorSpec(labels, index_sets)[source]

Static K-body iterator over a pre-computed list of site-index tuples.

This iterator evaluates a term kernel once per entry in index_sets. Each entry is a K-tuple of integer site indices that are bound to the corresponding element of labels inside the evaluation environment.

For a single-site iterator over all N sites, use KBodyIteratorSpec(labels=("i",), index_sets=tuple((k,) for k in range(N))). For a static triplet iterator, provide the explicit list of (e1, e2, e3) triplets. For a global (one-branch) term, use KBodyIteratorSpec(labels=(), index_sets=((),)).

Parameters:
labels

Ordered tuple of K label strings bound per iteration.

Type:

tuple

index_sets

M-tuple of K-tuples of int site indices.

Type:

tuple

__init__(labels, index_sets)
Parameters:
Return type:

None

Methods

__init__(labels, index_sets)

format_iterate_line([max_shown])

Returns a compact readable description of the iteration domain.

Attributes

kind

label_a

label_b

labels

index_sets