[SciPy-user] the meaning of c_ and r_

Alan G Isaac aisaac at american.edu
Fri Oct 22 09:18:06 CDT 2004


On Fri, 22 Oct 2004, Francesc Alted apparently wrote:
> 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.

I think that would be backwards of what is expected,
since r_[] is supposed to create a stack of rows.
But perhaps the following from 
  http://www.american.edu/econ/pytrix/pyGAUSS.py
gives you what you want.  (Requires access to
arange and transpose from Scipy, Numeric, or numarray.)

Cheers,
Alan Isaac

#seqa: n element additive sequence from start by inc
def seqa(start,inc,n): return transpose([start+inc*arange(n)])





More information about the SciPy-user mailing list