Functions¤
DomainFunction wraps callables with explicit domain metadata, so that operators and
constraints can compose without losing coordinate meaning.
phydrax.domain.DomainFunction
¤
A callable with explicit domain and coordinate semantics.
A DomainFunction represents a mathematical map
where the domain \(\Omega\) is a phydrax.domain object carrying labeled factors
(e.g. a space-time domain \(\Omega = \Omega_x \times \Omega_t\) with labels "x" and
"t"). The tuple deps specifies which labels the function actually depends on.
Phydrax operators (gradients, divergences, integrals, etc.) act on DomainFunction
objects, and constraints evaluate them on sampled batches.
Algebra
DomainFunction implements pointwise arithmetic. For example, for compatible
domains,
and when combining functions with different domains, the domains are joined and both functions are promoted to the joined domain.
Notes
- If
funcis array-like, it is treated as a constant function on \(\Omega\). - If
funcis callable, Phydrax passes randomness through a keyword-onlykeyargument (when provided by downstream sampling/solvers). - Evaluation returns a
coordax.Fieldwhose named axes are inferred from the sampling structure (paired blocks and/or coord-separable axes).
T
property
¤
Transpose the last two array axes of the output.
If \(u(z)\in\mathbb{R}^{m\times n}\) then \((u^T)(z)=u(z)^T\).
__init__(*, domain: _AbstractDomain, deps: collections.abc.Sequence[str], func: collections.abc.Callable | ArrayLike | None, metadata: collections.abc.Mapping[str, typing.Any] | None = None)
¤
depends_on(var: str) -> bool
¤
Return whether this function depends on the labeled variable var.
promote(new_domain: _AbstractDomain) -> DomainFunction
¤
View this function as defined on a larger domain.
If \(\Omega\subseteq\Omega'\), then promotion constructs \(u':\Omega'\to\mathbb{R}^m\) by ignoring the extra coordinates:
In practice this means that all labels of the current domain must appear in
new_domain.labels, and the underlying callable is reused unchanged.
with_metadata(**metadata: typing.Any) -> DomainFunction
¤
Return a copy with metadata merged into the existing metadata.