Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Is there a parallel version of matrix multiplication in MATLAB?
Date: Wed, 4 Nov 2009 16:17:19 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 19
Message-ID: <hcs9ef$c0u$1@fred.mathworks.com>
References: <hcqehk$17u$1@fred.mathworks.com> <hcs5it$2gu$1@fred.mathworks.com> <hcs88f$psp$1@fred.mathworks.com> <hcs8t2$7r8$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257351439 12318 172.30.248.38 (4 Nov 2009 16:17:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 16:17:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:582432


Arrg, there is still another bug...

% binary decomposition
nb = dec2bin(n)-'0';
ak = a;
if nb(end)
    d = a;
else
    d = 1;
end
for k=length(nb)-1:-1:1
    ak = ak*ak;
    if nb(k)
        d = d*ak;
    end
end


Bruno