Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: divide and conquer matrix
Date: Thu, 18 Jun 2009 20:46:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 32
Message-ID: <h1e92a$bd7$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1245357962 11687 172.30.248.38 (18 Jun 2009 20:46:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 18 Jun 2009 20:46:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1875128
Xref: news.mathworks.com comp.soft-sys.matlab:548759


Hi 
I have a problem with a large matrix, what I want to do is to divide the matrix into 4 submatrices, do some operation then reassemble the submatrix together.  A toy example

A = [1 2 3 ; 3 4 5 ; 2 3 4; 5 1 2 ]
A =

     1     2     3
     3     4     5
     2     3     4
     5     1     2
 I want to divide A into ANY approximately equal sized partitions, for example
1 2 
3 4 

3
5

2 3 
5 1 

4
2

then do some operation, say add 2 to each element.  Then reassemble them together, to get

     3     4     5
     5     6     7
     4     5     6
     7     3     4
What is the most efficient way of doing this?
Thanks
Diego