Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Is there a parallel version of matrix multiplication in MATLAB?
Date: Wed, 4 Nov 2009 10:12:21 -0500
Organization: The MathWorks, Inc.
Lines: 26
Message-ID: <hcs5it$2gu$1@fred.mathworks.com>
References: <hcqehk$17u$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1257347486 2590 172.31.44.65 (4 Nov 2009 15:11:26 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 15:11:26 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:582399



"Cindy" <xzhan2@fhcrc.org> wrote in message 
news:hcqehk$17u$1@fred.mathworks.com...
> Hi, I am calculating powers of large matrix. For example, taking a matrix 
> of size 2000*2000 to the power of 6. I know that MATLAB  is known for its 
> performance in matrix operations. But in this case, it is still quite 
> slow.

From the way you phrased your question, I suspect you're raising the matrix 
to the 6th power using repeated multiplication.  If so, why?  Just use ^ 
(the MPOWER operator) instead.

a = rand(2000);
tic
    b = a*a*a*a*a*a;
t1 = toc
tic
    c = a^6;
t2 = toc

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ