Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Fast Matrix*Diagonal*Matrix operation
Date: Thu, 3 Feb 2011 20:57:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 34
Message-ID: <iif4qv$a1d$1@fred.mathworks.com>
References: <ii7d79$lto$1@fred.mathworks.com> <ii7o08$lf$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 1296766623 10285 172.30.248.38 (3 Feb 2011 20:57:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 3 Feb 2011 20:57:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2429683
Xref: news.mathworks.com comp.soft-sys.matlab:707981

Hi proecsm,

Thanks for your reply. The first two lines below are my codes for computing Q'*D(t)*Q, where D(t) = diag(sig3) and sig3 changes every iteration.  I still need several other lines to implement additional computations. 

I would appreciate if anyone could speed up the code.

----------------
Qtmp = bsxfun(@times,Q.',sig3');
H = Qtmp*Q;
p = sqrt(-eta)*sig2./sig1;
H = H - bsxfun(@times,p,p');
H(1:(N+1):end) = diag(H) + sig1 - sig2.^2./sig1;
-------------------------------------

best,

Gongguo
"proecsm" wrote in message <ii7o08$lf$1@fred.mathworks.com>...
> "Gongguo Tang" wrote in message <ii7d79$lto$1@fred.mathworks.com>...
> > Hi there,
> > 
> > I have a code that computes Q'*D(t)*Q many times. Here Q is a fixed mxn matrix with m < n, while the diagonal matrix D depends on the iteration t. 
> > 
> > Because I have so many iterations that the operation slows done the entire process. 
> > 
> > I am wondering if there is any way to obtain Q'*D(t)*Q as fast as possible. Maybe from the result of Q'*Q or some kind of decomposition of Q'*Q?
> > 
> > Thanks in advance!
> > 
> > best,
> > 
> > Gongguo
> 
> I think it is unlikely that there is a shortcut using Q'*Q or decomposition thereof.  More likely is if you could a snippet of your code, someone could suggest a more efficient approach