[Numpy-discussion] creating column vectors

Sven Schreiber svetosch at gmx.net
Wed Feb 8 06:35:19 CST 2006


Stefan van der Walt schrieb:
> This is probably a silly question, but what is the best way of
> creating column vectors? 'arange' always returns a row vector, on
> which you cannot perform 'transpose' since it has only one dimension.
> 
> mat(arange(1,10)).transpose()
> 

mat(range(1,10)).T is a bit shorter, but I would agree that doing matrix
algebra in numpy is not as natural as with explicitly matrix-oriented
languages; my understanding is that this is due to numpy's broader
(n-dimensional) scope.

Numpy-masters: Is there a way to set a user- or project-specific config
switch or something like that to always get matrix results when dealing
with 1d and 2d arrays? I think that would make numpy much more
attractive for people like Stefan and me coming from the 2d world.

cheers,
Sven




More information about the Numpy-discussion mailing list