|
|
| File Information |
| Description |
This function does exactly what Matlab KRON does, but for large full matrices, the engine uses BSXFUN to accelerate the calculation.
Another advantage is no intermediate large matrices are generated (four temporary arrays in case of KRON).
Here is the benchmark code and result:
clear,
gain=[];
mem = memory;
maxn = (mem.MaxPossibleArrayBytes/32)^0.25;
n = 10:10:maxn;
for sz=n
A=rand(sz); B=rand(sz);
t1=Inf;
for ntry=1:10
tic; K = kron(A,B); t1=min(t1,toc);
end
clear K
t2=Inf;
for ntry=1:10
tic; K = kronecker(A,B); t2=min(t2,toc);
end
clear K
gain(end+1) = t1/t2;
end
fprintf('Size A/B Speed gain\n');
fprintf(' %02d %1.2f \n', [n; gain]);
Size A/B Speed gain
10 1.17
20 3.48
30 3.78
40 3.73
50 3.68
60 4.22
70 3.81 |
| Acknowledgements |
This submission has inspired the following:
Kronecker product
|
| MATLAB release |
MATLAB 7.4 (R2007a)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 22 Jun 2009 |
Miss spelling corrected |
|
Contact us at files@mathworks.com