quick_tensortt

# Import statement

from hottbox.utils.generation import quick_tensortt
quick_tensortt(full_shape, rank, base='arange')[source]

Simplified creation of generic tensor in tensor train form

Parameters
full_shapetuple

Desired shape of the tensor when it is reconstructed.

ranktuple

Desired tt rank of the tensor.

basestr

Id of base function that generates values for the components of tensor train tensor. If not one from {"arange", "randn", "rand", "ones"} then np.arange will be used.

Returns
tensor_ttTensorTT

Examples

>>> from hottbox.utils.generation import quick_tensortt
>>> tensor_tt = quick_tensortt(full_shape=(3, 4, 5), rank=(2, 3), base="ones")
>>> print(tensor_tt)
    Tensor train representation of a tensor with tt-rank=(2, 3).
    Shape of this representation in the full format is (3, 4, 5).
    Physical modes of its cores represent properties: ['mode-0', 'mode-1', 'mode-2']
>>> tensor = tensor_tt.reconstruct()
>>> print(tensor)
    This tensor is of order 3 and consists of 60 elements.
    Sizes and names of its modes are (3, 4, 5) and ['mode-0', 'mode-1', 'mode-2'] respectively.