The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Flattening a hypermatrix into an ordinary matrix
Replies: 7   Last Post: Jun 2, 2012 5:51 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bill Rowe

Posts: 1,647
Registered: 3/14/08
Re: Flattening a hypermatrix into an ordinary matrix
Posted: Jun 2, 2012 5:44 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 6/1/12 at 5:19 AM, wrote:

>I have an n x n hypermatrix, the entries of which are m x m blocks.
>For example A below (m=3, n=2):

>A22={{E11,E12,E13},{E21,E22,E23},{E31,E32,E33}}; A={{

>I want to convert this to an ordinary n*m x n*m matrix. For the
>example I want A to become


>This can be easily done with C style loops as


>but is there a more elegant way using Flatten?

Better would be to use ArrayFlatten which is specifically
designed for this task, i.e.,

In[6]:= ArrayFlatten[a]

{{b11, b12, b13, c11, c12, c13}, {b21, b22, b23, c21, c22, c23},
{b31, b32, b33, c31, c32, c33}, {d11, d12, d13, e11, e12, e13},
{d21, d22, d23, e21, e22, e23}, {d31, d32, d33, e31, e32, e33}}

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.