ufv_lift_factors#
- t3toolbox.backend.ufv_operations.ufv_lift_factors(frame_data, curvature_damping, rcond=None)#
def ufv_lift_factors( frame_data: typ.Tuple[ NDArray, # down_tucker_supercore, (d,)+C+(nD, N) NDArray, # up_tt_supercore, (d,)+C+(rL, nU, rR) NDArray, # left_tt_supercore, (d,)+C+(rL, nD, rL) NDArray, # right_tt_supercore, (d,)+C+(rR, nD, rR) typ.Tuple[int, ...], # shape typ.Tuple[NDArray, NDArray, NDArray, NDArray], # (down, up, frame_left, frame_right) masks; HOST bool ], curvature_damping: typ.Union[float, NDArray], # RELATIVE: eps = curvature_damping * ||X||_HS, >= 0 rcond: typ.Optional[float] = None, # relative clip; None -> the ragged default per REAL block ) -> fv_operations.LiftFactors: # SUPERCORE-valued, stack C (the field shapes below)
The uniform twin of
fv_lift_factors(): the damped pseudo-inverses that lift a uniform frame’s coordinates to raw core variations of its base point.The frame is masked once (its padded slots hold the construction’s orthonormal completions, which must not pair up), then the same derivation runs on the supercores: the right-to-left zipper of the left chain against the right chain (
tt_zipper_right_to_left(), a scan over the mode axis), the centersH_i = L_i T_iand the Tucker factorsS_i^T = <U_i, H_i>asd-prefixed grouped contractions, and ONE batched damped pseudo-inverse per family (damped_pseudo_inverse()). The returnedLiftFactorsholds supercores where the ragged one holds tuples:tucker_pinvs(d,)+C+(nD, nU)andtucker_svals(d,)+C+(min(nU, nD),);bond_pinvs(d,)+C+(rR, rL): thed - 1bond factorsT_i^{+eps}and, in the last slot, the boundary pass-through (1at the real(0, 0)entry), so the undamped last TT slotGdot_{d-1} = H_{d-1}is one more slice of the same contraction;bond_svals(d-1,)+C+(min(rL, rR),)andepsC, as the ragged twin.
Padding. A masked factor is the real block bordered by exact zeros, so its padded singular values are exactly 0 and the clip maps them to a filter of exactly 0 (
padded sigma = 0 -> f = 0); the pinvs are re-masked with the frame’s masks as well, so their padding is exactly zero whatever the SVD’s singular vectors hold there.rcond=Noneclips each block at its REAL dimensions (the ragged default,dtype eps * max(m, n), per slot and stack element), so a varying-rank stack keeps exactly the singular values the ragged lift keeps. The padded singular values are reported as exactly 0 (zeroed by the host masks): a consumer reading the smallest one must restrict to the real slots (the geometry’ssigma_mindoes, from the same masks).Requires an orthogonal frame (check-free, like all backend functions). Dispatch is inferred; the masks stay host numpy.
Examples
On a frame packed from a ragged one – with padding forced on every family – the real blocks are the ragged factors, and the padding is exactly zero:
>>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> import t3toolbox.backend.fv_conversions as fvc >>> import t3toolbox.backend.fv_operations as fvo >>> import t3toolbox.backend.ufv_conversions as ufc >>> import t3toolbox.backend.ufv_operations as ufo >>> np.random.seed(0) >>> x = t3.TuckerTensorTrain.randn((5, 6, 7), (2, 3, 2), (1, 2, 2, 1)) >>> frame, _ = fvc.t3_orthogonal_representations(x.data) >>> uframe = ufc.t3frame_to_ut3frame(frame, N=8, nD=4, nU=4, rL=3, rR=3) >>> lf, ulf = fvo.fv_lift_factors(frame, 1e-3), ufo.ufv_lift_factors(uframe, 1e-3) >>> ulf.tucker_pinvs.shape, ulf.bond_pinvs.shape ((3, 4, 4), (3, 3, 3)) >>> all(np.allclose(ulf.tucker_pinvs[i][:P.shape[0], :P.shape[1]], P) for i, P in enumerate(lf.tucker_pinvs)) True >>> all(np.allclose(ulf.bond_pinvs[i][:P.shape[0], :P.shape[1]], P) for i, P in enumerate(lf.bond_pinvs)) True >>> float(np.abs(ulf.tucker_pinvs[1][3:, :]).max()), ulf.bond_pinvs[2].tolist() # padding; the boundary slot (0.0, [[1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]) >>> bool(np.isclose(ulf.eps, lf.eps)) True
- Parameters:
frame_data (t3toolbox.backend.common.typ.Tuple[NDArray, NDArray, NDArray, NDArray, t3toolbox.backend.common.typ.Tuple[int, ...], t3toolbox.backend.common.typ.Tuple[NDArray, NDArray, NDArray, NDArray]])
curvature_damping (t3toolbox.backend.common.typ.Union[float, NDArray])
rcond (t3toolbox.backend.common.typ.Optional[float])
- Return type: