Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: vectorizing matrix multiplication
Date: Fri, 17 Jun 2011 18:19:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 11
Message-ID: <itg5qp$6h6$1@newscl01ah.mathworks.com>
References: <itcuh5$jfa$1@newscl01ah.mathworks.com> <itff70$ptf$1@newscl01ah.mathworks.com> <itfuee$ddh$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1308334745 6694 172.30.248.47 (17 Jun 2011 18:19:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 17 Jun 2011 18:19:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:732465

"Nate" wrote in message <itfuee$ddh$1@newscl01ah.mathworks.com>...
> Thank you very much Roger and Matt, that's exactly what I was looking for.
- - - - - - - - - -
  It might be more efficient to do the permute/transpose first on the smaller arrays:

 [n,p] = size(a); q = size(b,2);
 C = num2cell(bsxfun(@times,reshape(a.',p,1,n),reshape(b.',1,q,n)),3);

(using Matt's bsxfun method.)

Roger Stafford