ENH: add block() function to create block arrays#5057
ENH: add block() function to create block arrays#5057sotte wants to merge 7 commits intonumpy:masterfrom
Conversation
|
Being as cynical as I am, how does this play together with all the other stacking functions ;)? What I mean is, can you write to the mailing list as usual, because it is a new function, plus I think we can probably find a better name. Another thing I think, we limit the outer scope to list/tuple explicitly anyway (not much choice there I guess), so if we add it, maybe make it N-dimensional? |
|
Oh, about doctests... Those are not run currently, so not sure if they are sufficient, but add them as normal tests too at least. (Since I like at least some failure tests often, there probably should be a few more tests anyway) |
|
By the way, this looks similar to bmat. |
|
How would anyone know, none of the devs use matrices ;) |
This would explain why numpy/scipy functions related to |
|
I think that is mostly because of the intrinsic problems with matrices if you don't want to constantly check matrices explicitly... But enough for that. |
Why? They sure look like rows when printed: In [8]: np.arange(10) |
|
I updated my PR. Because of the discussion here #5605 I renamed the function to Some remarks:
Feedback welcome! |
|
@abalkin it's just my personal pet I guess :) It does not really matter for the pull request. |
|
Do you think this is ready to be merged? |
`block` is similar to Matlab's square bracket stacking functionality for block matices. `block` is an addition to the current stacking functions vstack, hstack, stack.
|
One of my new year's resolution is to get my pull requests merged. So, what do you think? |
Sorry that this didn't get reviewed yet Stefan. It seems useful to multiple people and isn't hard to review, so let's make sure we have a serious look before the next release (I gave it the 1.12.0 milestone). |
numpy/core/shape_base.py
Outdated
There was a problem hiding this comment.
Can you hide this somewhere in the Notes section? Putting Matlab syntax here so prominently feels wrong, plus for a minute I read this as the Python syntax to use.
|
I can't see the forest for the trees so I talked to my rubber duck. What do we expect? Do we want If we use Now, I'm actually inclined to use |
|
@sotte Take a look at the commit message guidelines: |
|
@charris I guess I'm too late. Thanks a lot! Was a lot of fun...as always! |
blockis similar to matlab's "square bracket stacking" functionality:[A B; C D].So you can write:
The one thing I'm not super happy with is that 1-D arrays are treated as row vectors and I personally think of them as column vectors.
Are the doctests sufficient or should I create proper unittests?