t3toolbox.OLD_uniform.ut3_entry#

t3toolbox.OLD_uniform.ut3_entry(cores: UniformTuckerTensorTrain, index: NDArray, use_jax: bool = False) NDArray#

Compute entry (entries) of a uniform Tucker tensor train.

If index is outside the tensor, the result is undefined. In this case, the function may either return a meaningless number, or raise an error.

Examples

>>> import numpy as np
>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.uniform_tucker_tensor_train as ut3
>>> x = t3.t3_corewise_randn(((14,15,16), (4,5,3), (1,4,2,1))) # T3
>>> index = (3,1,2)
>>> x_312 = t3.t3_entry(x, index)
>>> print(x_312) # (3,1,2) entry from T3:
-1.4931654579929192
>>> cores, masks = ut3.t3_to_ut3(x) # Convert to Uniform T3
>>> print(ut3.get_original_structure(masks)) # original (shape, tucker_ranks, tt_ranks):
((14, 15, 16), (4, 5, 3), (1, 4, 2, 1))
>>> print(ut3.get_uniform_structure(cores)) # uniform shape and ranks, (d,N,n,r):
(3, 16, 5, 4)
>>> x_312_uniform = ut3.ut3_entries(cores, index) # (3,1,2) entry from uniform T3:
>>> print(x_312_uniform)
-1.4931654579929197

Multiple entries:

>>> import numpy as np
>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.uniform_tucker_tensor_train as ut3
>>> x = t3.t3_corewise_randn(((14,15,16), (4,5,3), (1,4,2,1)))
>>> index = ((3,10), (1,9), (2,8))
>>> x_312 = t3.t3_entry(x, index)
>>> print(x_312)
-6.127319174475167
>>> cores, masks = ut3.t3_to_ut3(x)
>>> x_312_uniform = ut3.ut3_entries(cores, index)
>>> print(x_312_uniform)
-6.127319174475165