Superkron is a generalization of Matlab's kron function. It allows to compute the kronecker product of more than two matrices in one shot, and also works for multidimensional arrays having more than two dimensions.
Jean-Daniel (2020). Superkron (https://www.mathworks.com/matlabcentral/fileexchange/32578-superkron), MATLAB Central File Exchange. Retrieved .
You are right that removing these two lines speeds up the computation, but the result is then incorrect:
taking the kronecker product of [1 2] with [3 4] without these lines would (wrongly) produce [3 6 4 8], whereas kron([1 2], [3 4]) = [3 4 6 8].
Thanks for pointing to the useful package parafac!
By the way, by deleting these lines, better results are achiveved for PARAFAC components reconstruction.
M = reshape(M,[s1 s2]);
M = permute(M,reshape([nbDim+1:2*nbDim;1:nbDim],1,2*nbDim));
The results keep the same but better ordered for these kind of reconstructions. Im still thinking in multidimensional representation from your results.
Thanks for the feedbacks!
Superkron already supports multidimensional matrices. For instance,
superkron(rand([1 1 3 2]), rand([1 2 1 2 5]))
returns an object of size 1x2x3x4x5.
Excelent, maybe a multidimensional representation instead of 2D would be helpful
It is what I needed! Thanks a lot!
Very useful thanks
Fixed a bug that caused crashing when using inputs with more than 1 dimension difference. (Thanks to Mauro Faccin)
Changed picture format from png to jpeg.