ut3_operations#

Structural operations on uniform supercore data, and the uniform weighted-layer core ops.

ut3_squash_tails/ut3_reverse, stack/unstack + leaf structure, and the packing seam (pack_vectors/unpack_vectors/is_packed/pack_if_ragged) behind the packedness-mirror convention (user-facing ops mirror the input’s packedness).

The weighted layer (uniform twins of the ragged t3_*_weights ops, same module split): ut3_absorb_weights / ut3_weights_consistent / ut3_reciprocal_weights / ut3_sqrt_weights / ut3_concatenate_weights / ut3_kronecker_weights. Note this module does not import the masking layer: weighting and masking are kept apart, and the shared mechanics they both need (prefix_mask, require_concrete_masks) live in common (docs/contributor/weighted_internals.md).

Functions#

ut3_leaf_structure(d)

Template marking one uniform-T3 .data leaf for the tree machinery in stacking.py.

ut3_squash_tails(data)

Sum the leading/trailing TT bonds down to rank 1 (preserves the tensor), updating those edge

ut3_reverse(data)

Reverse the mode order (supercores, shape, and masks). Operates on the full .data tuple.

pack_vectors(unpacked_vectors[, N])

Zero-pad and stack a sequence of (ragged-length) vectors into one supercore-shaped tensor.

unpack_vectors(packed_vectors, unpacking_shape)

Slice a packed supercore-shaped tensor back into a tuple of (ragged-length) vectors.

is_packed(vectors)

Whether mode vectors are packed (a single supercore-shaped ndarray) or ragged (a len=d

pack_if_ragged(vectors[, N])

Pack vectors iff ragged (a len=d sequence); an already-packed array is returned unchanged.

ut3_unstack(x)

Unstack a uniform Tucker tensor train into an array-like tree of unstacked ones.

ut3_stack(xx)

Stack an array-like tree of uniform Tucker tensor trains into one.

ut3_absorb_weights(x, weights)

Contract diagonal edge weights into a uniform Tucker tensor train's supercores (shape-preserving).

ut3_weights_consistent(x, weights)

True iff weights fits x: the padded weight shapes match, and the edge masks are equal.

ut3_reciprocal_weights(weights)

Elementwise 1/w on the real slots (masks unchanged) -- e.g. to form inverse-singular-value

ut3_sqrt_weights(weights)

Elementwise sqrt on the real slots (masks unchanged). The padding is neutralized rather than

ut3_concatenate_weights(weights_A, weights_B)

Per-edge concatenation of two uniform weights -- the + / direct-sum combine, where ranks add.

ut3_kronecker_weights(weights_A, weights_B)

Per-edge Kronecker product of two uniform weights -- the Hadamard () combine, where ranks