TuckerTensorTrain.is_left_orthogonal#
- t3toolbox.tucker_tensor_train.TuckerTensorTrain.is_left_orthogonal(atol=1e-09)#
def is_left_orthogonal(self, atol: float = 1e-9) -> NDArray: # bool array, shape = stack_shape (scalar unstacked)
True (per stack element) if this T3 is in left-orthogonal form: every Tucker core down-orthogonal and every TT core except the last left-orthogonal (the last TT core is the center remainder).
Non-enforcing convenience checker (max-abs deviation from the identities
<= atol; seet3_orthogonality_residual()). At3svd()result is left-orthogonal, as is the result ofrank_adjustment_sweep('left_to_right'). Per-stack-element bool array (scalar when unstacked); reduce with.all()for a single verdict.Examples
>>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> np.random.seed(0) >>> x = t3.TuckerTensorTrain.randn((6, 7, 8), (5, 6, 7), (1, 4, 3, 1)) >>> print(x.is_left_orthogonal()) # a random T3 is not in any orthogonal form False >>> x2, _, _ = x.t3svd() # a t3svd result is left-orthogonal >>> print(x2.is_left_orthogonal()) True >>> print(x2.is_right_orthogonal()) # ...but not right-orthogonal False
Stacked: a per-element bool array. Stack a left-orthogonal element with a non-orthogonal one:
>>> m = t3.TuckerTensorTrain.randn((5, 6, 7), (2, 2, 2), (1, 2, 2, 1)) # minimal -> t3svd keeps ranks >>> stacked = t3.TuckerTensorTrain.stack([m.t3svd()[0], m]) >>> print(stacked.is_left_orthogonal().shape, stacked.is_left_orthogonal()) (2,) [ True False]
- Parameters:
atol (float)
- Return type: