Mathew,

Can you please let me know what change you made to the BlockMatrix
class, so I can
just do it and move forward.  Thanks for your suggested solution/
workaround.

Comer

On Jan 21, 9:59 am, Matthew <mrock...@gmail.com> wrote:
> This isn't a solution for you Comer unless you want to play with the
> code, but the BlockMatrix class is almost able to do this. To get the
> code below to work I had to make a slight (one line) alteration to the
> Matrix class.
>
> BlockMatrix(Matrix([[eye(3), eye(3)],[eye(3), eye(3)]]))
> ⎡⎡1  0  0⎤  ⎡1  0  0⎤⎤
> ⎢⎢       ⎥  ⎢       ⎥⎥
> ⎢⎢0  1  0⎥  ⎢0  1  0⎥⎥
> ⎢⎢       ⎥  ⎢       ⎥⎥
> ⎢⎣0  0  1⎦  ⎣0  0  1⎦⎥
> ⎢                    ⎥
> ⎢⎡1  0  0⎤  ⎡1  0  0⎤⎥
> ⎢⎢       ⎥  ⎢       ⎥⎥
> ⎢⎢0  1  0⎥  ⎢0  1  0⎥⎥
> ⎢⎢       ⎥  ⎢       ⎥⎥
> ⎣⎣0  0  1⎦  ⎣0  0  1⎦⎦
>
> Anyway, it'd be nice if all the matrix types could work together. The
> biggest impediment to this is the need for an explicit Matrix type
> which is also Basic.
>
> On Jan 20, 5:48 pm, Aaron Meurer <asmeu...@gmail.com> wrote:
>
>
>
>
>
>
>
> > The best way to do this is to use row_join and col_join:
>
> > In [53]: a = Matrix([[1, 2], [3, 4]])
>
> > In [54]: b = Matrix([[5, 6], [7, 8]])
>
> > In [55]: a.row_join(b)
> > ⎡1  2  5  6⎤
> > ⎢          ⎥
> > ⎣3  4  7  8⎦
>
> > In [56]: a.col_join(b)
> > ⎡1  2⎤
> > ⎢    ⎥
> > ⎢3  4⎥
> > ⎢    ⎥
> > ⎢5  6⎥
> > ⎢    ⎥
> > ⎣7  8⎦
>
> > There is an open issue that would add a better interface for this
> > (http://code.google.com/p/sympy/issues/detail?id=2221), but it remains
> > to be fixed.  You're welcome to give it a shot! Ideally, you should be
> > able to build a Matrix from block elements just as easily as you can
> > from atomic elements.
>
> > Aaron Meurer
>
> > On Fri, Jan 20, 2012 at 3:59 PM, Comer Duncan <comer.dun...@gmail.com> 
> > wrote:
> > > I have some 3x3 matrices, to be exact there are four of them. I want
> > > to form a 6 x 6 matrix from a two by two block of the four.
> > > Specifically here they are:
>
> > >>>> FEx
> > > [0, 0, 0]
> > > [0, 0, 0]
> > > [0, 0, 0]
> > >>>> FBx
> > > [0, 0,  0]
> > > [0, 0, -1]
> > > [0, 1,  0]
> > >>>> GEx
> > > [0,  0, 0]
> > > [0,  0, 1]
> > > [0, -1, 0]
> > >>>> GBx
> > > [0, 0, 0]
> > > [0, 0, 0]
> > > [0, 0, 0]
>
> > > The block matrix I want can be written
> > > (FEx   FBx)
> > > (GEx  GBx)
>
> > > If the above formatted ok you should see what I want.
>
> > > However, the following attempt:
>
> > > Matrix(((Fex,FBx),(GEx,GBx)))
>
> > > produces
> > > Matrix((FEx,FBx),(GEx,GBx))
> > > Traceback (most recent call last):
> > >  File "<stdin>", line 1, in <module>
> > >  File 
> > > "/usr/local/lib/python2.6/dist-packages/sympy-0.7.1-py2.6.egg/sympy/matrice
> > >  s/matrices.py",
> > > line 158, in __init__
> > >    raise TypeError("Data type not understood")
> > > TypeError: Data type not understood
>
> > > When I enter Matrix((FEx,FBx,GEx,GBx))  I get:
> > > [0,  0,  0]
> > > [0,  0,  0]
> > > [0,  0,  0]
> > > [0,  0,  0]
> > > [0,  0, -1]
> > > [0,  1,  0]
> > > [0,  0,  0]
> > > [0,  0,  1]
> > > [0, -1,  0]
> > > [0,  0,  0]
> > > [0,  0,  0]
> > > [0,  0,  0]
>
> > > which is a 12 x 3 matrix.
> > > So my question is how to create a 6 x 6 matrix in the form indicated 
> > > above?
>
> > > Thanks for suggestions.
>
> > > Comer
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "sympy" group.
> > > To post to this group, send email to sympy@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > sympy+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/sympy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to