tensorly.random.random_kruskal

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

Generates a random CP tensor

Parameters:

shape : tuple

shape of the tensor to generate

rank : int

rank of the CP decomposition

full : bool, optional, default is False

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

orthogonal : bool, optional, default is False

if True, creates a tensor with orthogonal components

random_state : np.random.RandomState

context : dict

context in which to create the tensor

Returns:

random_kruskal : ND-array or 2D-array list

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