Comment #2 on issue 2212 by ronan.l...@gmail.com: Matrix([Matrix, …]) should work
http://code.google.com/p/sympy/issues/detail?id=2212

Nice! With your patch, Matrix(...) is able to stack its arguments vertically. This raises interesting additional points:
* it should be possible to stack things horizontally as well
* this feels like too much complexity for a constructor

So, building upon your patch, I think that Matrix should get 2 more constructors (i.e. classmethods returning instances of Matrix): Matrix.hstack and Matrix.vstack. These can be implemented very simply for now:

@classmethod
def vstack(cls, *args):
    return Matrix(args)

@classmethod
def hstack(cls, *args):
transpose = lambda arg: arg.transpose() if isinstance(arg, Matrix) else arg
    return Matrix(map(transpose, args)).transpose()

but ultimately, the actual logic for the operations should be transferred from Matrix.__init__. The new class methods will also deprecate .col_join() and .row_join().

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

Reply via email to