Folding and unfolding implementation
hosvd implementation