nkdsl.SymbolicOperatorSum¶
- class SymbolicOperatorSum(hilbert, terms, *, name=None, dtype_str=None, is_hermitian=None, metadata=None)[source]¶
Additive composition of multiple symbolic operators sharing one Hilbert space.
SymbolicOperatorSumis the canonical Hamiltonian-style container for DSL-defined operators. It preserves term ordering, flattens nested sums, and aggregates max-connection-size bounds across all contained terms.- Parameters:
hilbert (DiscreteHilbert) – Shared Hilbert space.
terms (Sequence[AbstractSymbolicOperator]) – Sequence of symbolic operator terms.
name (str | None) – Optional user-facing operator name.
dtype_str (str | None) – Optional explicit dtype override.
is_hermitian (bool | None) – Optional Hermiticity override (defaults to
Trueiff all contained terms are Hermitian).metadata (dict[str, Any] | None) – Optional metadata dictionary.
Methods
__init__(hilbert, terms, *[, name, ...])apply_scalar(scalar)Returns a scaled copy of this operator.
estimate_max_conn_size()Returns the aggregate static max-connection bound across all terms.
get_conn_padded(x)Raises until this operator has been compiled.
to_ir()Builds one aggregate IR from all contained terms.
Attributes
dtypeReturns matrix-element dtype.
dtype_strReturns matrix-element dtype as a normalized string.
free_symbolsReturns the union of free symbol names across all contained terms.
is_hermitianReturns whether this operator is declared Hermitian.
max_conn_sizeReturns a static upper bound on the number of connected states.
metadataReturns operator metadata dictionary.
nameReturns user-facing operator name.
operator_nameReturns user-facing operator name.
termsReturns contained additive terms in declaration order.