[SciPy-user] Couple of Matrix() questions

Pearu Peterson pearu at scipy.org
Sun Aug 31 14:13:57 EDT 2003


On Sun, 31 Aug 2003, Gary Pajer wrote:

> [...]
> >  >>> E=hstack((vstack((A,C)),vstack((B,D))))
> >
> > which is not an array type (maybe not a bad thing). However, I'd still
> > like to avoid so much work (typing, watching my tuples, etc.) to just
> > do something so simple. Oh well, Roberts matcat function seems to
> > work just great. I just hate to have a function for each common matrix
> > function when it could (or should) be part of the underlying class.
> 
> I argree entirely, and I continue to search for the syntax that makes it so.

How about adding some new ?stack-type of methods to Matrix:

  E = A.vstack(C).hstack(B.vstack(D))

? Suggestions for a better naming for such ?stack methods?

Another idea: extend Matrix constructor to accept a list of matrix-like
objects so that stacking of matrices can be achived as follows:

  E = mat([[A,B],[C,D]])

where A,B,C,D are Matrix instances with appropiate shapes.

Pearu






More information about the SciPy-User mailing list