Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Efficiently computing large numbers of vector norms
Replies: 16   Last Post: Nov 15, 2012 8:32 AM

 Messages: [ Previous | Next ]
 Matt J Posts: 4,997 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.

Date Subject Author
11/7/12 Harry Commin
11/7/12 Harry Commin
11/8/12 Teja Muppirala
11/8/12 Teja Muppirala
11/8/12 Bruno Luong
11/8/12 Matt J
11/9/12 Matt J
11/12/12 Harry Commin
11/12/12 Harry Commin
11/13/12 Matt J
11/13/12 Harry Commin
11/13/12 Matt J
11/13/12 Harry Commin
11/13/12 Matt J
11/14/12 Harry Commin
11/15/12 Harry Commin
11/15/12 Matt J