nkdsl.SymbolicDiscreteJaxOperator¶
- class SymbolicDiscreteJaxOperator(hilbert, name='operator', *, dtype='float64', hermitian=False)[source]¶
Fluent builder for declarative symbolic quantum operators.
The builder accumulates one or more terms. Each term consists of an iterator (which sites to visit), an optional predicate (which visits to activate), and one or more emissions (how to rewrite the configuration and what matrix element to assign per active visit).
Calling any iterator method (
for_each_site,for_each_pair, …,globally) seals the previous term (if any) and begins a new one..whereand.emitalways target the current open term.- Parameters:
hilbert (DiscreteHilbert) – NetKet
DiscreteHilbertspace.name (str) – Readable operator name (accessible as
.nameon the resultingSymbolicOperator).dtype (str) – Matrix-element dtype string (default
"float64").hermitian (bool) – Whether to declare the operator Hermitian.
Methods
__init__(hilbert[, name, dtype, hermitian])append_emission_clause(spec, *, method_name)Appends emission behavior described by one normalized emission clause spec.
append_predicate(predicate, *[, method_name])Appends one predicate to the current term.
build()Seals all open terms and returns a
SymbolicOperator.compile(*[, backend, operator_lowering, ...])Convenience shortcut:
.build().compile(...).emit([update, matrix_element, amplitude, tag])Appends one output branch to the current term.
emit_else([update, matrix_element, ...])Appends the
elsebranch to the current conditional emission chain.emit_elseif(predicate[, update, ...])Appends an
elseifbranch to the current conditional emission chain.emit_if(predicate[, update, matrix_element, ...])Appends the
ifbranch of a conditional emission chain.fanout(hint)Backward-compatible alias for
max_conn_size().for_each(labels, *, over)Iterates over an arbitrary static list of K-tuples.
for_each_distinct_pair([label_a, label_b])Iterates over all ordered pairs
(i, j)withi, j ∈ [0, N).for_each_pair([label_a, label_b])Iterates over all ordered pairs
(i, j)withi, j ∈ [0, N).for_each_plaquette(label_a, label_b, ...)Iterates over a static list of ordered plaquettes (4-body).
for_each_site([label])Iterates over all sites ``0 .
for_each_triplet(label_a, label_b, label_c, ...)Iterates over a static list of ordered triplets.
globally()Sets a global iterator, one branch per configuration.
max_conn_size(hint)Sets an explicit static max-connection-size hint for the current term.
named(name)Assigns a readable name to the current term.
open_term(iterator)Opens a new in-progress term with the provided iterator.
where(predicate)Sets the branch predicate for the current term.
Attributes
hilbertReturns the Hilbert space associated with this builder.