Changelog¶
nkDSL v0.1.2¶
New features¶
Added
nkdsl.compiler.passes.diagnostics.SymbolicDiagnosticsPass, a compiler-integrated DSL linting pass that reports symbol, index, and connectivity diagnostics during.compile().Extended
nkdsl.symbol()(andExpressionContext.symbol) with first-class symbol declarations:default=...,doc=..., anddtype=.... Declared defaults are now used during compilation/evaluation and are no longer reported as unresolved free symbols.Added conditional emission chaining with
emit_if(...),emit_elseif(...), andemit_else(...).Added first-class emission clause extensions via
nkdsl.AbstractEmissionClause,nkdsl.register_emission_clause(), andnkdsl.available_emission_clause_names().Added fluent math helpers on
nkdsl.AmplitudeExprso matrix-element expressions can be written as chained calls like(site("i").value + 1).sqrt().conj()(includingneg(),abs_(),wrap_mod(), andpow(...)), while preserving existingAmplitudeExpr.<helper>(...)usage.Added
hop(src, dst, amount=1)as a small occupation-transfer update helper, equivalent toshift(src, -amount).shift(dst, +amount).
Improvements¶
Improved operator algebra ergonomics:
sum([op1, op2, ...])now works for symbolic and compiled operators by treating numeric zero as the additive identity in reverse-add dispatch (0 + op -> op).Lowered connectivity kernels now deduplicate connected states by default, summing matrix elements for duplicate
x'targets and dropping zero-amplitude components (including invalidated branches). This behavior is controlled bydeduplicate_connected_componentsand defaults toTrue.
Backwards incompatible changes¶
None.
Deprecations¶
None.
Bug fixes¶
Fixed masked-branch evaluation in the JAX lowerer so matrix-element expressions are evaluated lazily on active branches, avoiding inactive-path numerical issues (for example
1 / site("i").valuewhen masked out).Added lint error
NKDSL-E003for potential division-by-zero on direct runtime state reads, includingsite("i").value,emitted("i").value,source_index(k), andtarget_index(k).
Documentation¶
Updated DSL docs for symbolic parameters, including examples for
symbol("J", default=..., doc=..., dtype=...)and guidance on how this interacts with lint diagnostics for unresolved symbols.Extended linting docs with the new
NKDSL-E003message and guidance for guarding divisions over runtime state values.Updated emission/connectivity semantics docs to describe default connected component deduplication and zero-amplitude pruning.
nkDSL v0.1.1a0¶
New features¶
Added
nkdsl.compiler.SymbolicOperatorLoweringRegistryandnkdsl.compiler.SymbolicOperatorLoweringTarget.Added
nkdsl.compiler.DEFAULT_SYMBOLIC_OPERATOR_LOWERINGandnkdsl.compiler.default_symbolic_operator_lowering_registry().Added
operator_loweringselection in compiler options and convenience compile entry points.Added support for custom connection methods such as
_get_conn_paddedfor computational-style operator subclasses.Added a clause abstraction layer for DSL extensions:
nkdsl.AbstractIteratorClauseandnkdsl.AbstractPredicateClause, together with registration APIs, so custom fluent iterator/predicate methods can be added without patching builder internals.Added
nkdsl.source_index()/nkdsl.target_index()(and matchingExpressionContextmethods) as user-facing aliases for static source/target flat-index reads.
Improvements¶
Preserved default runtime behavior:
"netket_discrete_jax"->DiscreteJaxOperator.get_conn_padded.Included operator-lowering target identity in compilation signatures so cache keys remain consistent across different lowering targets.
Backwards incompatible changes¶
None.
Deprecations¶
None.
Bug fixes¶
None.
Documentation¶
Added Operator lowering registry with rationale, API surface, and usage examples.
Added a new Guides section with detailed DSL extension guides, including custom iterator and predicate clause examples.