utv_gauge_residual#

t3toolbox.backend.utv_operations.utv_gauge_residual(frame_data, variations_data, scale=None)#
def utv_gauge_residual(
        frame_data,       # UT3Frame .data
        variations_data,  # UT3Variations .data

        scale:  typ.Optional[NDArray] = None,  # operand scale, broadcastable to K+C (trailing axes), >= 0; None = own norm
) -> NDArray:  # shape = variation stack (K+C); per stack element (scalar/0-d when unstacked)

Max violation of the gauge conditions for a uniform tangent vector, per stack element (the uniform mirror of tv_operations.tv_gauge_residual()).

Each Tucker variation must be orthogonal to its down-core (D V^T = 0) and each left-interior TT variation orthogonal to its left-core ((L^L)^T H^L = 0). Mask-once, then the gauge grams vectorized over d, max-abs reduced over the gram axes (keeping the stack), then the max over all checks (the last TT core is excluded – the [:-1] boundary). Relative, like the ragged twin: the max gram is divided by the coordinate norm of the whole (masked) tangent per stack element, so the result is in [0, 1] and scale-free; a caller thresholds it against a relative tolerance.

scale is the operand scale of the ragged twin (a tangent formed by cancellation, a - b, is measured against max(||a||, ||b||) rather than its own tiny norm): the grams are divided by max(||v||, scale), a floor that never makes the check stricter; None (the default) is the self-relative residual, unchanged. Per stack element, broadcast against K+C by the trailing-axis rule (a scalar, C or K+C; any other shape raises); the norms are the MASKED coordinate norms (utv_corewise_inner()), padding don’t-care. See tv_operations.tv_gauge_residual().

Parameters:

scale (t3toolbox.backend.common.typ.Optional[NDArray])

Return type:

NDArray