Path: news.mathworks.com!newsfeed-00.mathworks.com!panix!bloom-beacon.mit.edu!llnews!53ab2750!not-for-mail
From: Peter Boettcher <boettcher@ll.mit.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: bottleneck calculation
References: <ft05oa$46f$1@fred.mathworks.com>
Message-ID: <muyzlscgvuu.fsf@G99-Boettcher.llan.ll.mit.edu>
Organization: MIT Lincoln Laboratory
User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/23.0.0 (gnu/linux)
Cancel-Lock: sha1:a8IXRyrK8G8vaZ8UTUQTYUFlyLs=
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Lines: 25
Date: Wed, 02 Apr 2008 10:44:09 -0400
NNTP-Posting-Host: 155.34.163.114
X-Complaints-To: news@ll.mit.edu
X-Trace: llnews 1207146855 155.34.163.114 (Wed, 02 Apr 2008 10:34:15 EDT)
NNTP-Posting-Date: Wed, 02 Apr 2008 10:34:15 EDT
Xref: news.mathworks.com comp.soft-sys.matlab:460567



"Dave Brackett" <davebrackett@hotmail.com> writes:

> Hi, I have a calculation which i'm trying to speed up with 
> no great success. It is quite a bottleneck for an 
> optimisation run.
>
> Basically I have lots of 2x2 matrices which all need 
> multiplying and this is the bottleneck in my code. This is 
> currently achieved by:
>
> for g=1:length(r0i)
> prodH=prodH*[ai(g),bi(g);ci(g),di(g)];
> end
>
> Any improvement in this would significantly speed up the 
> calculation; is there a better way of doing this? Feel free 
> to ask me questions if i've not been clear. Thanks for your 
> help.

See the mex file NDFUN at http://www.mit.edu/~pwb/matlab/

The 'mprod' subfunction will do this, if you assemble your ai/bi/ci/di
into a 3D matrix, one 2x2 matrix per "page".

-Peter