I understood, just after I sent my first email, that the dimensions of the array are different for the suggested behaviour, since: shape(r_[1:3:5j]) (5,) while for a corresponding row-vector ( 1 by N matrix) it had to be something like: array([ r_[1:3:5j] ]) [ [ 1. 1.5 2. 2.5 3. ]] with: shape(array([ r_[1:3:5j] ])) (1, 5) And the column vectors had to be of shape (5, 1) which is achieved by: transpose(array([c_[1:3:5j]])) or transpose(array([r_[1:3:5j]])) - I found this confusing... So the current behaviour of c_ and r_ IMHO looks like a re-write of vstack and hstack together with linspace functionality, which doesn't supply any distinct functionality, or clearer usability of matrix notations or operations. When I first read the introduction to scipy I was hoping for ease-of-use abbreviations for matrix operations, and at first understood the shortcuts r_ and c_ to help with that. OK. -I was wrong ;) btw.: is it an issue at all, to discuss something like this here? -This is implemented at quite a low level, and I'm not sure if there is a way to retain backwards-compatibility, AND provide another behaviour of c_ and r_. On Fri, Oct 22, 2004 at 02:19:19PM +0200, Francesc Alted wrote:
In SciPy tutorial (http://www.scipy.org/documentation/tutorial.pdf) Travis Oliphant says:
"""
The "r" stands for row concatenation because if the ob jects between commas are 2 dimensional arrays, they are stacked by rows (and thus must have commensurate columns). There is an equivalent command c that stacks 2d arrays by columns but works identically to r for 1d arrays.
"""
So, it seems that this is not a bug, but a feature. Although I would also find interesting that r_[1:3:5j] would generate:
array([ 1. , 1.5, 2. , 2.5, 3. ])
and that c_[1:3:5j]) would do:
array([[ 1. ], [ 1.5], [ 2. ], [ 2.5], [ 3. ]])
However, I don't know if this would be counter-intuitive in some cases.
-- Francesc Alted
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
-- Gerald Richter <richter@hephy.oeaw.ac.at> phone: +43 1 5447328/27 Institute of high energy physics (HEPHY) http://wwwhephy.oeaw.ac.at/ Vienna/Austria