ufv_operations#

Stateless stack/unstack for the uniform frame-variations layer (UT3Frame / UT3Variations).

Mirror of ut3_operations.ut3_unstack / ut3_stack for the bv .data layout (*supercores, shape, masks), generic over the supercore count (4 for a frame, 2 for variations; both carry the SAME 4-tuple of rank masks). The stack lives at axes 1 .. len(stack_shape) (axis 0 is the mode index d, NOT a stack axis); the supercores and all four masks unstack along it, while the int-tuple shape is shared and woven onto every leaf. The masks’ differing leading axis (d vs d+1) is irrelevant – only axes 1..k are sliced.

It also holds the uniform twins of the frame-level constructions of fv_operations that the optimizers need: the canonical zero-point frame (ufv_zero_point_frame) and the exact Hessian’s lift factors (ufv_lift_factors; at a shared point ufv_tied_lift_factors).

Functions#

ufv_variation_shapes(frame_data)

The uniform variation supercore shapes of a frame -- the backend twin of the frontend

ufv_leaf_structure(d, n_supercores)

Template marking one bv .data leaf (*supercores, shape, masks) for the tree machinery.

ufv_unstack_axes(data, n_supercores, axes)

Unstack a bv .data tuple along the GIVEN array axes (a sub-run of the stack), leaving the rest.

ufv_stack_axes(xx, n_supercores, axes_start)

Stack an array-like tree of bv .data leaves onto a CONTIGUOUS run of array axes starting at

ufv_unstack(data, n_supercores)

Unstack a (stacked) bv .data tuple into an array-like tree of unstacked ones (the WHOLE stack).

ufv_stack(xx, n_supercores)

Stack an array-like tree of bv .data leaves into one (the WHOLE stack at axes 1 ..). Inverse

ufv_variations_sum_stack(data[, axis])

Sum a UT3Variations over stack axes (a batch of tangents -> their sum; corewise == tangent sum by

ufv_frame_reverse(data)

Reverse the mode order of a UT3Frame .data. The left/right supercores and their masks

ufv_variations_reverse(data)

Reverse the mode order of a UT3Variations .data: the tucker-variation supercore reverses; the

ufv_save(file, data)

Save a bv .data tuple to a .npz (3 families: the supercores, the rank masks, the shape

ufv_load(file[, use_jax])

Load a bv .data tuple saved by ufv_save(). The supercores follow use_jax; the

ufv_frame_orthogonality_residual(data)

Max deviation of the four masked frame supercores from orthonormality, per stack element (shape

ufv_zero_point_frame(frame_data[, groups, seed])

The uniform twin of fv_zero_point_frame(): the canonical

ufv_lift_factors(frame_data, curvature_damping[, rcond])

The uniform twin of fv_lift_factors(): the damped

ufv_tied_lift_factors(frame_data, curvature_damping, ...)

The uniform twin of fv_tied_lift_factors(): the lift factors of a uniform

ufv_absorb_weights(variations, weights)

Absorb the four-family metric weights into the VARIATION supercores -- the uniform twin of

ufv_weights_consistent(variations, weights)

True iff the four weight families fit variations (non-raising): padded widths match, the weight

ufv_weights_from_ut3_weights(weights)

Build uniform frame weights (a tangent metric) from uniform base-point edge weights -- the twin of

ufv_reciprocal_weights(weights)

Elementwise 1/w on the real slots of all four families (masks unchanged); the padding stays a

ufv_sqrt_weights(weights)

Elementwise sqrt on the real slots of all four families; the padding stays a canonical, finite

ufv_concatenate_weights(weights_A, weights_B)

Per-edge concatenation of two frame-weight 4-tuples (the + combine; ranks add). Supercores and

ufv_kronecker_weights(weights_A, weights_B)

Per-edge Kronecker product of two frame-weight 4-tuples (the Hadamard combine; ranks multiply).