lgatr.primitives.invariants

Invariants: inner product, absolute squared norm, and Pin-invariant utilities.

Functions

abs_squared_norm(x)

Compute a positive-semidefinite modification of the squared norm.

inner_product(x, y)

Compute the inner product of multivectors f(x, y) = <x, y> = <~x y>_0.

lgatr.primitives.invariants.abs_squared_norm(x)[source]

Compute a positive-semidefinite modification of the squared norm.

Suitable for layer normalization (the standard GA squared norm is not positive semidefinite).

Parameters:

x (Tensor) – Input multivector of shape (..., 16).

Returns:

Geometric-algebra norm of x, shape (..., 1).

Return type:

outputs

lgatr.primitives.invariants.inner_product(x, y)[source]

Compute the inner product of multivectors f(x, y) = <x, y> = <~x y>_0.

Equal to geometric_product(reverse(x), y)[..., [0]], but faster.

Parameters:
  • x (Tensor) – First input multivector of shape (..., 16) or (..., channels, 16). Batch dimensions must be broadcastable between x and y.

  • y (Tensor) – Second input multivector of shape (..., 16) or (..., channels, 16). Batch dimensions must be broadcastable between x and y.

Returns:

Result of shape (..., 1). Batch dimensions are the broadcast of x and y.

Return type:

outputs