UT3FrameWeights#

class t3toolbox.uniform_frame_variations_format.UT3FrameWeights#

Diagonal weights defining a metric on the tangent coordinates of a UT3Frame – the uniform twin of T3FrameWeights.

Four families, each len=d (one per variation core), packed into supercores + a UT3VariationsMasks holder: up (on H’s nU leg), down (on V’s nD leg), left (H’s rL), right (H’s rR). Absorbed into the variation supercores, leaving the frame orthonormal and untouched – so it is O(ranks).

Batching: a weight is FRAME-like (it is absorbed into the variations, but it batches with the frame – do not conflate the two). Every supercore is (d,) + C + (size,) where C is the frame stack, not the variations’ K + C: one metric per base point, shared by all K tangent vectors at that frame, broadcast over K for free (C is innermost). There is no shape field: weights live only on internal edges.

Examples

>>> import numpy as np
>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.uniform_tucker_tensor_train as ut3
>>> import t3toolbox.uniform_frame_variations_format as ubvf
>>> import t3toolbox.uniform_manifold as ut3m
>>> np.random.seed(0)
>>> x  = t3.TuckerTensorTrain.randn((6, 7, 8), (2, 2, 2), (1, 2, 2, 1), stack_shape=(2,))
>>> ux = ut3.UniformTuckerTensorTrain.from_t3(x)
>>> frame, _ = ubvf.ut3_orthogonal_representations(ux)
>>> v = ut3m.UNIFORM_COREWISE.randn(frame, stack_shape=(3,))   # 3 tangents at each of 2 base points
>>> print(frame.stack_shape, v.stack_shape)            # C, then K + C
(2,) (3, 2)

The metric is built from the base point’s singular values, so it carries C – and pairs directly with the K-stack of tangents there:

>>> W = ubvf.UT3FrameWeights.from_ut3weights(ut3.UT3Weights.from_ut3svd(ux)).reciprocal()
>>> print(W.stack_shape)                               # C, NOT K + C
(2,)
>>> print(np.asarray(v.weighted_norm(W)).shape)        # one norm per stacked tangent
(3, 2)
up_weight_supercore: NDArray#
down_weight_supercore: NDArray#
left_weight_supercore: NDArray#
right_weight_supercore: NDArray#
masks: UT3VariationsMasks#

Methods#

supercores()

(up, down, left, right) weight supercores.

data()

Raw-array view, mirroring the fields: (up, down, left, right, (4 rank masks)). Backend

d()

nU()

nD()

rL()

rR()

stack_shape()

The frame stack C (() if unstacked) -- never the variations' K + C.

up_ranks()

down_ranks()

left_ranks()

right_ranks()

validate()

Structural: the four masks are boolean and match their supercores (same (d,)+C+(size,)).

__post_init__()

__repr__()

is_consistent_with(tangent)

True iff this metric can be absorbed into a UT3Tangent's (or UT3Variations') variations

reciprocal()

Elementwise 1/w on the real slots of all four families (e.g. the inverse-singular-value /

sqrt()

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

concatenate(other)

Per-edge concatenation (the + combine; ranks add). Output masks may go gappy.

kronecker(other)

Per-edge Kronecker product (the Hadamard combine; ranks multiply). Output masks are strided.

from_ut3weights(weights)

Build a tangent metric from uniform base-point edge weights (e.g.

from_t3frameweights(weights[, nU, nD, rL, rR])

Pack a ragged T3FrameWeights into a uniform one.

to_t3frameweights()

Convert back to ragged form. Unstacked: one