Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!o21g2000prn.googlegroups.com!not-for-mail
From: Nathan <ngreco32@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Divide, operate and reassemble matrix
Date: Thu, 18 Jun 2009 14:30:10 -0700 (PDT)
Organization: http://groups.google.com
Lines: 42
Message-ID: <728fb21e-1182-4780-b27d-44a4d369d85f@o21g2000prn.googlegroups.com>
References: <h1eb7l$531$1@fred.mathworks.com>
NNTP-Posting-Host: 198.206.219.33
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1245360610 20380 127.0.0.1 (18 Jun 2009 21:30:10 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 18 Jun 2009 21:30:10 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: o21g2000prn.googlegroups.com; posting-host=198.206.219.33; 
	posting-account=_KeVcAoAAAB7j3xn35ujaQ0BoQhuzwJP
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) 
	Gecko/2009060215 Firefox/3.0.11,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 wwwproxy-son-ca-01.ca.sandia.gov:80 (squid/2.5.STABLE14)
Xref: news.mathworks.com comp.soft-sys.matlab:548772


On Jun 18, 2:23 pm, "Diego Lass" <dlISC...@gmail.com> wrote:
> 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 4 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

You just posted this not an hour ago with a different title... Why?

Why disassemble and do operations when you can just do that operation
to each element in one instruction?