[SciPy-user] Question about trick index functions.

Sebastian Haase haase at msg.ucsf.edu
Fri Jan 6 11:07:52 CST 2006

On Thursday 05 January 2006 19:05, Travis Oliphant wrote:
> Hugo Gamboa wrote:
> >So what is the difference between r_ and c_ ?
> c_ is deprecated (it's there only for compatibility) :-)
First off, congratulation from me too - I looks great and I'm excited ;-)

Is it really true that c_ is deprecated  ?? It sounds quite useful to me:
r_ for row and c_ for column !
And maybe it should even turn a 1D into a (expected) 2D column (instead off 
just being a synonym for r_ )

- Sebastian

> For 1-d arrays there was never any difference.
> For 2-d arrays c_ and r_ stacked along different dimensions.
> Now, the r_ constructor can stack along any dimension by using a string
> integer as the last element, but note this has the same limitation as
> concatenate:  the arrays stacked together must actually have the
> dimension to stack along....
> Compare the output of
> a = arange(6).reshape(2,3)
> r_[a,a]
> with
> r_[a,a,'-1']
> c_[a,a]  # not recommended for use anymore...
> The real use of r_[] is to quickly concatenate arrays together to build
> up complicated arrays.  It was developed when I was using SciPy to teach
> a signal processing course and the student lab-manuals had Matlab
> exercises where they used matlab to build up compilcated arrays quickly
> using bracket notation:
> -Travis

More information about the SciPy-user mailing list