tensorly.random.random_cp

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

Generates a random CP tensor

Parameters:
shapetuple

shape of the tensor to generate

rankint

rank of the CP decomposition

fullbool, optional, default is False

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

orthogonalbool, optional, default is False

if True, creates a tensor with orthogonal components

random_statenp.random.RandomState
contextdict

context in which to create the tensor

Returns:
random_cpND-array or 2D-array list

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