e3j.core.Polynomial

class e3j.core.Polynomial(monomials: Monomial, coef: Array | None = None, shape: tuple | None = None)

Batched polynomials, aggregating monomials with a coefficient matrix.

Given a d-variate Monomial instance M and a (k, n) coefficient matrix C, evaluating P = Polynomial(M, C) on a (b, d) point cloud x yields batch_size * k scalars given by:

P(x)[s, i] = sum(C[i, j] * M(x)[s, j] for j in range(n))

Methods

C()

__call__(x)

Evaluate polynomials on a point cloud.

__init__(monomials[, coef, shape])

Create polynomials from array of monomials and coefficient matrix.

aggregate(mx)

coalesce([sort])

Aggregate coefficients on equal monomials.

concat(ps[, axis])

Concatenate polynomial instances.

stack(ps[, axis])

Stack polynomials along a given axis.

Attributes

coords

diff

Differential of polynomials.

exp

__call__(x: Array) Array

Evaluate polynomials on a point cloud.

Parameters:

(jax.Array) (x) – a point cloud of shape [..., d]

Returns:

evaluated polynomials, of shape [..., k] where k = p.coef.shape[0].

Return type:

px (jax.Array)

__init__(monomials: Monomial, coef: Array | None = None, shape: tuple | None = None)

Create polynomials from array of monomials and coefficient matrix.

Parameters:
  • monomials (Monomial) – an array of n monomials

  • coef (jax.Array | None) – an optional (k, n) matrix of coefficients, defaults to ones.

  • shape (tuple | None) – an optional leading shape, mostly useful to arrange outputs of polynomial differentials. Defaults to (k,).

coalesce(sort=False) Polynomial

Aggregate coefficients on equal monomials.

classmethod concat(ps: Polynomial | Monomial, axis: int = -1) Polynomial

Concatenate polynomial instances.

property diff: Polynomial

Differential of polynomials.

classmethod stack(ps: Polynomial, axis: int = -1) Polynomial

Stack polynomials along a given axis.