Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Faster and vectorized
Date: Thu, 29 Oct 2009 16:11:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 13
Message-ID: <hcceqn$h53$1@fred.mathworks.com>
References: <hcbr1h$ne0$1@fred.mathworks.com> <618a4964-ef9e-44c8-8e1d-c9c4b73d7a14@c3g2000yqd.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256832663 17571 172.30.248.37 (29 Oct 2009 16:11:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 29 Oct 2009 16:11:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1886545
Xref: news.mathworks.com comp.soft-sys.matlab:581028


> losing the temp arrays may make it a bit faster. other than that
> you'll just have to live with the fact that matlab is slow with loops.
> 
> for i = 1 : length(unC)
>    % Index the specific class
>     IDX = Class == unC(1,i);
> 
>     % weighted mean by row
>     Out(2:end,i) = sum(Values(IDX).*Weights(IDX),2)./sum(Weights(IDX),
> 2);
> end
Well i loose the matrix form of the inputs if i dont make use of the temp matrices...
unfortunately i can't suppress them in that way.