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.

SymbolicOperatorSum is 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 True iff all contained terms are Hermitian).

  • metadata (dict[str, Any] | None) – Optional metadata dictionary.

__init__(hilbert, terms, *, name=None, dtype_str=None, is_hermitian=None, metadata=None)[source]
Parameters:
  • hilbert (_install_doc_stubs.<locals>.DiscreteHilbert)

  • terms (Sequence[AbstractSymbolicOperator])

  • name (str | None)

  • dtype_str (str | None)

  • is_hermitian (bool | None)

  • metadata (dict[str, Any] | None)

Return type:

None

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

dtype

Returns matrix-element dtype.

dtype_str

Returns matrix-element dtype as a normalized string.

free_symbols

Returns the union of free symbol names across all contained terms.

is_hermitian

Returns whether this operator is declared Hermitian.

max_conn_size

Returns a static upper bound on the number of connected states.

metadata

Returns operator metadata dictionary.

name

Returns user-facing operator name.

operator_name

Returns user-facing operator name.

terms

Returns contained additive terms in declaration order.