Re: Merge of Matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg71181] Re: Merge of Matrices
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Thu, 9 Nov 2006 03:41:38 -0500 (EST)
On 11/8/06 at 6:15 AM, rberger06 at sinh.us (Robert Berger) wrote:
>I like to create from the four matrices A (N1 rows and N1 columns),
>B (N1 rows and N2 columns), C (N2 rows and N1 columns), D (N2 rows
>and N2 columns) a new matrix X of the form
>A B
>X =
>C D
>
>Once A & B and C & D have been merged, the first (A & B) and the
>second row (C& D) can be merged in that way by applying Join, which
>is not a problem but how can I merge A & B (and of course C & D) in
>that way?
Take a look at the functions AppendColumns and AppendRows in the
package LinearAlgebra`MatrixManipulation`. Or if you prefer to
"roll your own"
Joining A, B first can be done by
Transpose[Join@@(Transpose/@{A,B})]
or
MapThread[Join@@{##}&,{A,B}]
Similarly with C,D
Then the two intermediate matrices can be combined using either
Join or Append to get the desired result.
--
To reply via email subtract one hundred and four