neuralqx.experimental.operators.symbolic.core package¶
Core symbolic operator types.
- class AbstractSymbolicOperator(hilbert, *, name, dtype_str='complex64', is_hermitian=False, metadata=None)¶
Bases:
ComputationalJaxOperatorAbstract base class for all symbolic (DSL-defined) operators.
Symbolic operators extend
ComputationalJaxOperatorand declare their action through a typed IR rather than a hand-written JAX kernel. They cannot execute until the compiler has lowered them to a concrete JAX kernel vianeuralqx.experimental.operators.symbolic.compiler.SymbolicCompiler.compile().Attempting to call
_get_conn_padded()before compilation raisesSymbolicOperatorExecutionError.- Parameters:
hilbert (
DiscreteHilbert) – Discrete Hilbert space this operator is defined on.name (
str) – User-facing operator name.dtype_str (
str) – String label for the matrix-element dtype.is_hermitian (
bool) – Whether this operator is declared Hermitian.metadata (
dict[str,Any] |None) – Optional extra metadata dictionary.
- class CompiledOperator(hilbert, *, name, fn, is_hermitian, dtype)¶
Bases:
ComputationalJaxOperatorAn executable operator produced by lowering a
SymbolicOperator.CompiledOperatoris the concrete result ofsymbolic_op.compile()orDOperator(...).compile(). Itsget_conn_paddedkernel is a pure JAX function that can be JIT-compiled, vmapped, and differentiated.The class name is fixed and stable, it does not encode the operator name or structure. The readable operator name is available via the
nameproperty.- name¶
Operator name (from the DSL definition).
- is_hermitian¶
Whether this operator is declared Hermitian.
- dtype¶
Matrix-element NumPy dtype.
- class SymbolicOperator(hilbert, name, ir_terms, *, dtype_str='complex64', is_hermitian=False, metadata=None)¶
Bases:
AbstractSymbolicOperatorA symbolic operator built via the
DOperatorDSL.SymbolicOperatoris the canonical result ofDOperator(...).build(). It holds an ordered list of typed IR terms and provides a.compile()method to lower them to an executableCompiledOperator.Instances are not directly executable: calling
get_conn_paddedbefore compilation raisesSymbolicOperatorExecutionError.- name¶
User-facing operator name.
- hilbert¶
The NetKet Hilbert space.
- dtype¶
Matrix-element dtype.
- is_hermitian¶
Whether this operator is declared Hermitian.
Example:
op = ( DOperator(hi, "hopping") .for_each_pair("i", "j") .where(site("i") > 0) .emit(shift("i", -1).shift("j", +1), amplitude=1.0) .build() ) compiled = op.compile() xp, mels = compiled.get_conn_padded(x_batch)
- class SymbolicOperatorSum(hilbert, terms, *, name=None, dtype_str=None, is_hermitian=None, metadata=None)¶
Bases:
AbstractSymbolicOperatorAdditive 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 fanout bounds across all contained terms.- Parameters:
hilbert (
DiscreteHilbert) – Shared Hilbert space.terms (
Sequence[AbstractSymbolicOperator]) – Sequence of symbolic operator terms.is_hermitian (
bool|None) – Optional Hermiticity override (defaults toTrueiff all contained terms are Hermitian).metadata (
dict[str,Any] |None) – Optional metadata dictionary.