param_norm#

hypercoil.functional.kernel.param_norm(X: Tensor, theta: Tensor | None = None, *, squared: bool = False) Tensor[source]#
hypercoil.functional.kernel.param_norm(X: BCOO, theta: Tensor | BCOO | None = None, *, squared: bool = False) BCOO

Parameterised norm of observation vectors in an input tensor.

For a tensor \(X\) containing features in column vectors, the parameterised norms of an observation vector \(X_i\) are

\(\|X_i\|_{\theta} = \sqrt{(X_i)^\intercal \theta (X_i)}\) or \(\|X_i\|_{\theta} = (X_i)^\intercal \theta (X_i)\) if squared is True. The non-squared form reduces to the L2 norm if theta is the identity matrix.

Note

The inputs here are assumed to contain features in row vectors and observations in columns. This differs from the convention frequently used in the literature. However, this has the benefit of direct compatibility with the top-k sparse tensor format.