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 21:16:04 +0000 (UTC)
Organization: Xoran Technologies
Lines: 5
Message-ID: <iif5uj$mkl$1@fred.mathworks.com>
References: <ii7d79$lto$1@fred.mathworks.com> <ii7o08$lf$1@fred.mathworks.com> <iif4qv$a1d$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1296767764 23189 172.30.248.37 (3 Feb 2011 21:16:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 3 Feb 2011 21:16:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:707987

 >H = H - bsxfun(@times,p,p');

also, note that if p is a vector, then this is just

H=H-p*p'