UniformTuckerTensorTrain#
- class t3toolbox.uniform_tucker_tensor_train.UniformTuckerTensorTrain#
A uniform Tucker tensor train: two supercores (the data) + a
UT3Masksholder (the static structure).tucker_supercore: shape(d,) + stack_shape + (n, N)tt_supercore: shape(d,) + stack_shape + (r, n, r)masks: theUT3Masks(shape mask + the two rank masks)
The mode index
dleads (outside the stack) so sweeps compile tolax.scanover axis 0 (docs/uniform_supercore_layout.md). Ranks may differ across the stack; the physical shape may not (docs/uniform_ranks_and_varieties.md).- shape: Tuple[int, Ellipsis]#
- property data: Tuple[NDArray, NDArray, Tuple[int, Ellipsis], Tuple[NDArray, NDArray]]#
(tucker_supercore, tt_supercore, shape, (2 rank masks)).Backend
ut3_*functions take this layout (supercore-only ops use.data[:2]; the staticshapeis.data[2]; mask-using ops unpack.data[3]). TheUT3Masksholder stays a frontend concern.
- property d: int#
Number of modes.
- Return type:
int
- property n: int#
Padded Tucker rank (
n >= maxof the real Tucker ranks).- Return type:
int
- property N: int#
Padded mode dimension (
N >= maxof the real shapes).- Return type:
int
- property r: int#
Padded TT rank (
r >= maxof the real TT ranks).- Return type:
int
- property stack_shape: Tuple[int, Ellipsis]#
Stack shape (
()if unstacked). Lives at axes1 .. len(stack_shape)(dis axis 0).- Return type:
Tuple[int, Ellipsis]
- property uniform_structure: Tuple[int, int, int, int, Tuple[int, Ellipsis]]#
(d, N, n, r, stack_shape)– the padded structure.- Return type:
Tuple[int, int, int, int, Tuple[int, Ellipsis]]
- property tucker_ranks: NDArray#
Real Tucker ranks (from
tucker_edge_mask; may vary across the stack).- Return type:
- property tt_ranks: NDArray#
Real TT ranks (from
tt_edge_mask; may vary across the stack).- Return type:
- property structure: Tuple[Tuple[int, Ellipsis], NDArray, NDArray, Tuple[int, Ellipsis]]#
(shape, tucker_ranks, tt_ranks, stack_shape)– the real structure.
- __rmul__#
- property minimal_ranks: Tuple[NDArray, NDArray]#
Structural minimal ranks
(min_tucker_ranks, min_tt_ranks)for this UT3’s shape/ranks.
- property has_minimal_ranks: NDArray#
True (per stack element) if this UT3’s ranks are structurally minimal. Per-element (uniform ranks vary across the stack), reduced over the mode axes; reduce with
.all()for a single verdict.- Return type:
- property contains_jax: bool#
- Return type:
bool
Methods#
|
Check the structural invariants (shapes mutually consistent, rank masks boolean, |
|
|
Zero the padded ("garbage") regions of the supercores (the masks are unchanged). |
|
|
Form the dense tensor, |
|
Pack a ragged |
|
Convert back to ragged form. |
|
Reverse the mode order. |
Sum the leading/trailing TT bonds down to rank 1 (preserves the represented tensor). |
|
|
Scale by a scalar. |
|
|
|
Add two uniform Tucker tensor trains (direct sum, then squash). Requires matching shape / d / |
|
|
Sum the represented tensors over the entire stack -> one unstacked uniform T3 (genuine tensor |
|
|
Hilbert-Schmidt inner product with another uniform Tucker tensor train (shape=stack_shape). |
|
Hilbert-Schmidt (Frobenius) norm of the represented tensor (shape=stack_shape). |
|
Entry/entries of the represented dense tensor, evaluated without forming it (shares |
|
Contract the represented tensor with vectors in all modes, without forming it (shares |
|
Probe: contract all-but-one mode, for each mode (leaving mode |
|
Symmetric directional derivatives of |
|
Symmetric all-modes apply derivatives (the derivative twin of |
|
Symmetric entry derivatives at |
|
Corewise (non-manifold) transpose of |
|
Corewise transpose of |
|
Corewise transpose of |
|
Corewise (non-manifold) transpose of |
|
Corewise transpose of |
|
Corewise transpose of |
|
Sum the represented tensor over all physical modes (shape=stack_shape). Partial sums ( |
Orthogonalize the Tucker cores, pushing the remainder up into the TT cores. |
|
Up-orthogonalize the TT cores, pushing the remainder down into the Tucker cores. |
|
Left-orthogonalize the TT cores. |
|
Right-orthogonalize the TT cores. |
|
|
True (per stack element) if in left-orthogonal form (Tucker supercores down-orthogonal AND TT |
|
True (per stack element) if in right-orthogonal form (Tucker supercores down-orthogonal AND TT |
|
Mask-truncated T3-SVD -- the basic algorithm, matching ragged |
|
A single directional sweep that drops structurally-redundant ranks (the separate |
|
Unstack into an array-like tree (shaped like |
|
Stack an array-like tree of UT3s into one stacked UT3. |
|
|
|
|
|
|
|
Uniform Tucker tensor train of zeros (padded regions masked to zero). |
|
Rank-1 uniform Tucker tensor train representing a tensor full of ones (every real entry == 1). |
|
Uniform Tucker tensor train with random N(0,1) supercores (padded regions masked to zero). |
|
Save to a |
|
Load from a |