k-mode folding of a matrix into a Tensor. This is the inverse funtion to k_unfold in the m mode. In particular, k_fold(k_unfold(tnsr, m),m,getModes(tnsr)) will result in the original Tensor.
Usage
k_fold(mat, m = NULL, modes = NULL)
Arguments
mat
matrix to be folded into a Tensor
m
the index of the mode that is mapped onto the row indices