quchip.declarative.expr¶
One backend-neutral expression tree for authored scalar and operator physics.
Functions
|
Normalize symbolic, matrix, or opaque callable operator authorship. |
|
Normalize symbolic, numeric, or opaque callable scalar authorship. |
|
Normalize an authored ket array or opaque callable without evaluating it. |
|
Coerce a scalar value into the shared expression tree. |
|
Return whether value is a callable authoring function, not a matrix-like object. |
|
Materialize authored physics as a backend-independent JAX array. |
|
Lower symbolic physics, passing an already-native contribution through. |
|
Materialize a scalar expression without coercing traced values. |
|
Lower scalar signal algebra into the backend-neutral signal program. |
Split a linear Hamiltonian sum into scalar-signal and operator factors. |
Classes
|
Attribute view exposing one owner's declared fields as symbolic leaves. |
|
Authored scalar and operator algebra, independent of numerical values. |
Exceptions
Numerical materialization was requested without every required value. |
- exception quchip.declarative.expr.UnboundParameterError[source]¶
Bases:
ValueErrorNumerical materialization was requested without every required value.
- quchip.declarative.expr.is_opaque_callable(value)[source]¶
Return whether value is a callable authoring function, not a matrix-like object.
- class quchip.declarative.expr.PhysicsExpr(kind, args=(), labels=(), _bindings=<factory>)[source]¶
Bases:
objectAuthored scalar and operator algebra, independent of numerical values.
- Parameters:
- classmethod parameter(*, scope, name, symbol=None, unit=None)[source]¶
Create a symbolic declared-parameter leaf.
- Parameters:
- Return type:
- classmethod literal(value)[source]¶
Create a literal scalar leaf.
- Parameters:
value (Any)
- Return type:
- classmethod from_matrix(value, *, labels, dims, name=None)[source]¶
Create a named backend-neutral matrix contribution.
- classmethod from_function(function, *arguments, labels, dims, name=None)[source]¶
Create an opaque matrix-valued contribution from a pure function.
The function runs only during numerical materialization. Display keeps its declared name and arguments, such as
X(a, b), without exposing the implementation as symbolic algebra.
- classmethod from_state(value, *, labels, dims, name)[source]¶
Create a named authored ket contribution.
- classmethod from_state_function(function, *arguments, labels, dims, name)[source]¶
Create an opaque callable ket contribution.
- classmethod from_signal(signal, *, name='f')[source]¶
Create a scalar time-function leaf backed by an engine signal.
- Parameters:
- Return type:
- embed(labels, dims)[source]¶
Embed this local contribution into an ordered composite Hilbert space.
- Parameters:
- Return type:
- with_bindings(bindings)[source]¶
Attach default values used only by direct numerical inspection.
- Parameters:
- Return type:
- class quchip.declarative.expr.ParameterNamespace(scope, fields)[source]¶
Bases:
objectAttribute view exposing one owner’s declared fields as symbolic leaves.
- quchip.declarative.expr.ensure_expr(value)[source]¶
Coerce a scalar value into the shared expression tree.
- Parameters:
value (Any)
- Return type:
- quchip.declarative.expr.as_operator_expr(value, *, labels, dims, name, arguments=(), owner=None, scope=None, allowed=None)[source]¶
Normalize symbolic, matrix, or opaque callable operator authorship.
- quchip.declarative.expr.as_scalar_expr(value, *, name, arguments=(), owner=None, scope=None, allowed=None)[source]¶
Normalize symbolic, numeric, or opaque callable scalar authorship.
- quchip.declarative.expr.as_state_expr(value, *, labels, dims, name, arguments=(), owner=None, scope=None, allowed=None)[source]¶
Normalize an authored ket array or opaque callable without evaluating it.
- quchip.declarative.expr.split_dynamic_hamiltonian(expr)[source]¶
Split a linear Hamiltonian sum into scalar-signal and operator factors.
Signal algebra may be nonlinear and may contain multiple signal leaves. Linearity is required only in the quantum operator: each additive term must contain one operator-valued factor multiplied by a scalar expression that depends on at least one delivered signal.
- Parameters:
expr (PhysicsExpr)
- Return type:
tuple[tuple[PhysicsExpr, PhysicsExpr], …]
- quchip.declarative.expr.scalar_signal_program(expr)[source]¶
Lower scalar signal algebra into the backend-neutral signal program.
- Parameters:
expr (PhysicsExpr)
- Return type:
- quchip.declarative.expr.materialize_expr(expr, backend, *, bindings=None, t=None)[source]¶
Lower symbolic physics, passing an already-native contribution through.