Turns the Khatri-product of matrices into a full tensor
factor_matrices = [|U_1, ... U_n|]becomes a tensor shape
(U.shape, U.shape, ... U[-1].shape)
kruskal_tensor : KruskalTensor = (weight, factors)
factors is a list of factor matrices, all with the same number of columns i.e. for all matrix U in factor_matrices: U has shape
(s_i, R), where R is fixed and s_i varies with i
mask : ndarray a mask to be applied to the final tensor. It should be
broadcastable to the shape of the final tensor, that is
(U.shape, ... U[-1].shape).
full tensor of shape
(U.shape, ... U[-1].shape)
This version works by first computing the mode-0 unfolding of the tensor and then refolding it.
There are other possible and equivalent alternate implementation, e.g. summing over r and updating an outer product of vectors.