File Exchange

image thumbnail

Superkron

version 1.8.0.0 (1.56 KB) by Jean-Daniel
An implementation of the kronecker product for multidimensional arrays.

5 Downloads

Updated 04 Nov 2011

View License

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.

Cite As

Jean-Daniel (2020). Superkron (https://www.mathworks.com/matlabcentral/fileexchange/32578-superkron), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)

BG

Fast

Jean-Daniel

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.

Jean-Daniel

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

Bingfan Liu

very useful

kowei tseng

Pi Ting

It is what I needed! Thanks a lot!

Very useful thanks

Updates

1.8.0.0

Fixed a bug that caused crashing when using inputs with more than 1 dimension difference. (Thanks to Mauro Faccin)

1.2.0.0

Changed picture format from png to jpeg.

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux