t3toolbox.manifold.retract#
- t3toolbox.manifold.retract(variation: t3toolbox.basis_coordinates_format.T3Variation, base: t3toolbox.basis_coordinates_format.T3Base, use_jax: bool = False) t3toolbox.tucker_tensor_train.TuckerTensorTrain#
Retract Tucker tensor train tangent vector to manifold.
- Parameters:
variation (T3Variation,) – Variation representing the tangent vector we wish to retract to the manifold
base (T3Base,) – Representation of the base point on the manifold where the tangent space is attached.
xnp – Linear algebra backend. Default: np (numpy)
- Returns:
Retraction of tangent vector onto the manifold.
- Return type:
t3.TuckerTensorTrain
See also
T3Base,t3_svdExamples
>>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> import t3toolbox.manifold as t3m >>> import t3toolbox.common >>> import t3toolbox.orthogonalization as orth >>> import t3toolbox.corewise as cw >>> p = t3.t3_corewise_randn(((14,15,16), (4,5,6), (1,3,2,1))) >>> base, _ = orth.orthogonal_representations(p) >>> variation = t3m.tangent_randn(base) # Random tangent vector >>> ret_v = t3m.retract(variation, base) # Retract tangent vector to manifold >>> ret_V = t3.t3_to_dense(ret_v) >>> V = t3m.tangent_to_dense(variation, base, include_shift=True) >>> print(np.linalg.norm(ret_V - V)) # vector changes 0.14335564543255402 >>> v2 = cw.corewise_scale(variation, 1e-2) # make the tangent vector shorter for smaller retraction >>> ret_v2 = t3m.retract(v2, base) >>> ret_V2 = t3.t3_to_dense(ret_v2) >>> V2 = t3m.tangent_to_dense(v2, base, include_shift=True) >>> print(np.linalg.norm(ret_V2 - V2)) # vector changes 4.9488133126395654e-05