[Numpy-discussion] numpy.stack -- which function, if any, deserves the name?
stefan.otte at gmail.com
Mon Mar 16 04:50:34 EDT 2015
> 1. np.stack for stacking like np.asarray(np.bmat(...))
I'm the author of this proposal. I'll just give some context real quickly.
"My stack" started really simple, basically allowing a Matlab-like
notation for stacking:
matlab: [ a b; c d ]
numpy: stack([[a, b], [c, d]]) or even stack([a, b], [c, d])
where a, b, c, and d a arrays.
During the discussion people asked for fancier stacking and auto
filling of non explicitly set blocks (think of an "eye" matrix where
only certain blocks are set).
Alternatively, we thought of refactoring the core of bmat  so that
it can be used with arrays and matrices. This would allow stack("a b;
c d") where a, b, c, and d are the names of arrays/matrices. (Also
bmat would get better documentation during the refactoring :)).
Summarizing, my proposal is mostly concerned how to create block
arrays from given arrays. I don't care about the name "stack". I just
used "stack" because it replaced hstack/vstack for me. Maybe "bstack"
for block stack, or "barray" for block array?
I have the feeling  that my use case is more common, but I like the
 Everybody generalizes from oneself. At least I do.
More information about the NumPy-Discussion