[Numpy-discussion] beginner question: rank-1 arrays

Robin robince at gmail.com
Mon Oct 8 18:00:39 EDT 2007


Hi,

I am trying to implement a project in scipy. I think I am getting somewhere
finally.

However in my code (I am converting from MATLAB) it is important to maintain
2d arrays, and keep the difference between row and column vectors. After
working through some initial problems I think I am getting more of a picture
of how things work in numpy.

However I am finding my code littered with things like:
np.array(np.r_[0:nterms],ndmin=2)    (for a row vector)
or
np.array(np.r_[0:nterms],ndmin=2).T (for a column vector)

Coming from matlab and being use to 0:10 for row or (0:10)' for column this
seems a bit messy. Is there a better way of constructing row/column 2d
arrays from a slice type range?

Thanks,

Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20071008/af097fa5/attachment.html>


More information about the NumPy-Discussion mailing list