tensorly.random.random_mps

random_mps(shape, rank, full=False, random_state=None, **context)[source]

Generates a random MPS/ttrain tensor

Parameters:

shape : tuple

shape of the tensor to generate

rank : int

rank of the MPS decomposition must verify rank[0] == rank[-1] ==1 (boundary conditions) and len(rank) == len(shape)+1

full : bool, optional, default is False

if True, a full tensor is returned otherwise, the decomposed tensor is returned

random_state : np.random.RandomState

context : dict

context in which to create the tensor

Returns:

MPS_tensor : ND-array or 3D-array list

  • ND-array : full tensor if full is True
  • 3D-array list : list of factors otherwise