Skip to content

Linear algebra¤

phydrax.operators.einsum(subscript: str, /, *operands: DomainFunction | ArrayLike) -> DomainFunction ¤

Einstein summation of DomainFunction and/or constant array operands.

Given operands \(u^{(1)}(z),\dots,u^{(k)}(z)\) (each either a DomainFunction or a constant array-like), returns the pointwise contraction specified by subscript, i.e.

\[ w(z) = \texttt{einsum}(\texttt{subscript}, u^{(1)}(z), \dots, u^{(k)}(z)). \]

Domains are joined across DomainFunction operands before evaluation. Constant operands are broadcast by einsum and do not contribute domain deps.

Arguments:

  • subscript: Einsum subscript string (as in opt_einsum.contract).
  • operands: One or more operands (DomainFunction or array-like). At least one operand must be a DomainFunction.

Returns:

  • A DomainFunction representing the contracted result.

phydrax.operators.norm(u: DomainFunction, /, *, order: int = 2) -> DomainFunction ¤

Pointwise vector norm of a DomainFunction.

Interprets the last axis of \(u(z)\) as a vector and returns

\[ \|u(z)\|_p, \]

where order=p. If \(u(z)\) is scalar, this returns \(|u(z)|\).

Arguments:

  • u: Input function.
  • order: Norm order \(p\) passed to jax.numpy.linalg.norm (ord=p).

phydrax.operators.trace(u: DomainFunction) -> DomainFunction ¤

Pointwise matrix trace.

Interprets the last two axes of \(u(z)\) as a matrix and returns \(\text{tr}(u(z))\).

Arguments:

  • u: Input DomainFunction whose values have at least two trailing axes.

Returns:

  • A DomainFunction representing the scalar trace field.

phydrax.operators.det(u: DomainFunction) -> DomainFunction ¤

Pointwise matrix determinant.

Interprets the last two axes of \(u(z)\) as a square matrix and returns \(\det(u(z))\).

Arguments:

  • u: Input DomainFunction whose values have trailing shape (n, n).

Returns:

  • A DomainFunction representing the scalar determinant field.