Matt J
Posts:
4,994
Registered:
11/28/09


Re: Efficiently computing large numbers of vector norms
Posted:
Nov 13, 2012 1:45 PM


"Harry Commin" wrote in message <k7u34n$7fs$1@newscl01ah.mathworks.com>... > > It would be interesting to know the data dimensions you're working with. > > For my tests, I had: > > N1 = 3; > N2 = 4; > Q1 = 180; > Q2 = 63; > > If I increase N1 and/or N2, the improvement (due to KronProd) decreases. ==============
I would definitely expect increasing improvement with increasing N1 and N2 and my tests below confirm this.
N1 = 100; N2 = 100; Q1 = 180; Q2 = 63;
At1=rand(Q1,N1)+i*rand(Q1,N1); At2=rand(Q2,N2)+i*rand(Q2,N2);
K=kron(At1,At2); Kop=KronProd({At2,At1});
nx=size(K,2); X2=rand(nx,nx);
tic; result = sum( abs( K*X2 ).^2 , 2) ; toc; %Elapsed time is 124.422905 seconds.
tic; result = sum( abs( Kop*X2 ).^2 , 2) ; toc; %Elapsed time is 10.947491 seconds.

