Norm
Shippingmatrix_normSelectable vector/matrix norm (Euclidean, L1, L∞, Lᵖ, L0, spectral, nuclear, operator)
Signature
Inputs
aSignal|Arrayrequired— A Vector, Matrix, or Tensor. Entrywise norms accept any rank; matrix norms require rank 2.
Outputs
normScalar— The selected norm value; carries the input's unit (except the dimensionless L0 count).
Parameters
| Key | Type | Default | Notes |
|---|---|---|---|
norm | enum | euclidean | one of: euclidean, l1, linf, lp, l0, spectral, nuclear, operator_1, operator_inf |
p | float | 2 | Exponent for the general Lᵖ norm (Σ|xᵢ|ᵖ)^(1/p). p ≥ 1 is a true norm; 0 < p < 1 a quasi-norm. Shown only when Norm = Lᵖ. |
Description
Norm is the one rank-polymorphic member of the linear-algebra family: a single ‖·‖ output whose value is chosen by the norm dropdown — and only the selected norm is computed, so you never pay for the ones you didn't ask for.
The entrywise norms — Euclidean/Frobenius (), L1 (), L∞ (), the general Lᵖ (, with the exponent p), and L0 (count of nonzeros) — flatten the array and apply at any rank: a vector, matrix, or tensor. The matrix-only norms require a 2-D input: spectral (largest singular value ), nuclear (trace norm ), and the induced operator norms — operator-1 (max column sum) and operator-∞ (max row sum). A matrix-only norm applied to a vector raises a clear backend error.
Because a norm is degree-1 homogeneous (), the output inherits the input's unit — with one exception: the L0 count is a dimensionless sparsity measure and carries no unit.
Mathematics
Examples
Euclidean norm of a vector
With norm = euclidean (the default) and input in metres, the output is — and it keeps the m unit. Switch the dropdown to l1 for , linf for , or l0 for (both entries nonzero, dimensionless).
Matrix norms on a 2×2
For : euclidean (Frobenius) is , operator_1 and operator_inf are , spectral is (), and nuclear is (). Selecting a matrix-only norm on a vector instead raises a 'needs a 2-D matrix' error.
Applications
- Measuring signal energy (L2), total variation (L1), or peak magnitude (L∞) of a vector.
- Regularization / sparsity metrics: L1, L0, and nuclear norms for compressed sensing and low-rank recovery.
- Quantifying matrix magnitude and gain via spectral/operator norms in stability analysis.
- Frobenius norm as an overall error measure between matrices.
Neat
It computes strictly the one norm the dropdown selects — a matrix never runs the extra operator/SVD passes unless you actually pick a spectral/nuclear/operator norm.
Entrywise norms are rank-agnostic (they flatten the buffer), so the same node handles vectors, matrices, and tensors, while matrix-only norms self-validate rank 2 with a clear error.
Unit handling encodes the math: norms are degree-1 homogeneous so they keep the input's unit, but the L0 nonzero-count is treated as a dimensionless sparsity measure.
Known issues
Selecting spectral, nuclear, or an operator norm on a non-2-D input errors (by design) — those norms are matrix-only.
The Lᵖ norm with $0<p<1$ is a quasi-norm (violates the triangle inequality), so treat sub-1 exponents as a sparsity-style measure, not a true norm.