Path: news.mathworks.com!not-for-mail
From: Edric M Ellis <eellis@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Is there a parallel version of matrix multiplication in MATLAB?
Date: Wed, 04 Nov 2009 08:29:46 +0000
Organization: The Mathworks, Ltd.
Lines: 24
Message-ID: <ytw4opahev9.fsf@uk-eellis-deb5-64.mathworks.co.uk>
References: <hcqehk$17u$1@fred.mathworks.com>
NNTP-Posting-Host: uk-eellis-deb5-64.mathworks.co.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: fred.mathworks.com 1257323386 29025 172.16.27.232 (4 Nov 2009 08:29:46 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 08:29:46 +0000 (UTC)
X-Face: $Ahg}Iylezql"r1WV1Me5&)ng"a4v%D>==KMs-elCfj"o}$bh-VOt7lVXgLWsC?9mZ`mINT
 G6PDvca;nrgs$lfcr0l1ew'N]>nXKl}m|Zpg>,6*gLp~-N0N2*+b.iwv=u>@R$L4SEG&NYUU;lSR@u
 IHphdAy
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)
Cancel-Lock: sha1:p5iDZ+E5rtrk4eWSJ7Oenxh/2x0=
Xref: news.mathworks.com comp.soft-sys.matlab:582286


"Cindy" <xzhan2@fhcrc.org> writes:

> 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.
>
> I have the parallel toolbox, I'm wondering is there any parallel version of
> matrix multiplication available? If so, could anyone give me a short example
> of how to use it?

There's matrix multiplication defined for distributed arrays that ship with the
Parallel Computing Toolbox. On a single machine (i.e. using "matlabpool local"),
the multithreaded version of mtimes is probably faster, but here's how to do it
(using R2009b syntax):

matlabpool open % plus any options
spmd
  d = codistributed.rand( 2000 );
  d * d * d * d * d * d;
end

Cheers,

Edric.