tensorly.random.cp_tensor

cp_tensor(shape, rank, full=False, orthogonal=False, random_state=None)[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

Returns:

cp_tensor : ND-array or 2D-array list

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