Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: organized scrambling of matrix
Date: Mon, 19 Apr 2010 10:34:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 27
Message-ID: <hqhbiu$ej6$1@fred.mathworks.com>
References: <hqh74e$2ml$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1271673246 14950 172.30.248.38 (19 Apr 2010 10:34:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 19 Apr 2010 10:34:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:627801

"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <hqh74e$2ml$1@fred.mathworks.com>...
> Hi all,
> I was wondering if there's a cleaner way to get:
> 
> K=vertcat(kron(U,conj(U)),
>               kron(flipud(U),conj(U)),
>               kron(U,flipud(conj(U))),
>               kron(flipud(U),flipud(conj(U))));
> 
> where U is a column vector.
> 
> Of course, I could save conj(U)=A, and flipud(U)=B, and flipud(conj(U))=C,
> 
> but it would still involve 4 kroneker products, even though it looks like there's a lot of symmetry and repetition in the command.
> 
> It would be neat to see if there's a clean alternative,
> Cheers!
----------
  Yes, it does seem a shame to do four times as many multiplications as are really necessary.  Try this:

 K = kron(U,conj(U)); % First block
 K = vertcat(K,reshape(flipud(reshape(K,[],length(U))),[],1)); % Add 2nd block
 K = vertcat(K,flipud(K)); % Add 3rd & 4th blocks

I don't know that this could be considered "cleaner", but it does have only one 'kron' operation.  The last step by itself would probably save some execution time but I am not sure of the middle step with its two reshapes.

Roger Stafford