nkdsl.SiteSelector

class SiteSelector(label, namespace='site')[source]

Symbolic selector for one Hilbert-space site iterator.

SiteSelector is created by site() and used inside DSL predicates, amplitude rules, and update programs. Attribute access on a selector returns symbolic AmplitudeExpr nodes that are resolved by the compiler at lowering time.

Parameters:
  • label (str) – Iterator label bound by for_each_site(label).

  • namespace (str)

__init__(label, namespace='site')[source]
Parameters:
Return type:

None

Methods

__init__(label[, namespace])

abs()

Returns |x[i]| as an amplitude expression.

as_site_ref()

Returns the site-index expression used in update op site parameters.

attr(name)

Returns a symbolic expression for an arbitrary site attribute.

Attributes

index

Returns symbolic expression for the integer index of this site.

label

Returns selector label.

namespace

Returns selector namespace.

value

Returns symbolic expression for the quantum number at this site.