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$>
References: <ii7d79$lto$> <ii7o08$lf$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1296766623 10285 (3 Feb 2011 20:57:03 GMT)
NNTP-Posting-Date: Thu, 3 Feb 2011 20:57:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2429683
Xref: 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;


"proecsm" wrote in message <ii7o08$lf$>...
> "Gongguo Tang" wrote in message <ii7d79$lto$>...
> > 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