From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matlab alternative to mtimesx for this problem ?
Date: Sun, 28 Aug 2011 23:24:09 +0000 (UTC)
Organization: University of Waterloo
Lines: 31
Message-ID: <j3eimp$op4$>
References: <j3e342$dbb$> <j3eb5j$52j$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1314573849 25380 (28 Aug 2011 23:24:09 GMT)
NNTP-Posting-Date: Sun, 28 Aug 2011 23:24:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1646679
Xref: comp.soft-sys.matlab:741518

Merci Bruno,

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message 
> > I want to integrate a function of w and t, wrt w, so the final answer should be a function of t. 

> Wait a minute, why you need to do thing so inefficiently? Sometime you just have to think harder than what you really computes.
> The above results are equal to (at numerical precision)
> > d = trapz(w,w)*t(:);

This is obviously not true for all functions of w and t, and the example I gave wasn't actually the function I'm integrating, but a simpler example.

> BTW: 
> repmat(w,length(t),1).*repmat(t',1,length(w)),
> bsxfun(@times,w,t')
> mtimesx(w,'T',t)
> is simply:
> >  t'*w

Thank you.


takes 4GB of RAM and 52 seconds. (same as REPMAT and BSXFUN)