Guest User

Untitled

a guest
Jan 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. clear all;
  2. m=7;n=12; % for example
  3. % direct method giving U (with memory issues for big m and n):
  4. B=round(9*rand(m,n))
  5. D=kron(B,B);
  6. U=D(:,n*(0:(n-1))+(1:n)); % straightforward "good column indices"
  7. % indirect method giving V (without memory issues):
  8. V=zeros(m^2,n);
  9. for q=1:n
  10. V(:,q)=kron(B(1:m,q),B(:,q));% "1D" Kronecker products
  11. end;
  12. max(max(abs(U-V))),% checking U and V are identical
Add Comment
Please, Sign In to add comment