From: Bill B. <wb...@gm...> - 2006-07-06 14:49:15
|
On 7/6/06, Tim Hochberg <tim...@co...> wrote: > > > -) Being able to distinguish between row and column vectors; I guess > > this is just not possible with arrays... > > > Why can't you distinguish between them the same way that the matrix > class does? Shape [1, N] is a row array, shape [N,1] is column array. Yep, that works. But there are still various annoyances. - You have to remeber to specify extra brackets all the time. Like array([[1,2,3]]) or array([[1],[2],[3]]). - And a slice of a vector out of a matrix has to be pumped back up to 2-D. If x has ndim==2, then to get a column out of it you have to do x[:,i,None] instead of just x[:,i]. To get a row you need x[j,None] instead of just x[j] Not horrible, but it feels a little klunky if you're used to something like Matlab. So matrix gets rid of a few annoyances like that ... and replaces them with a few of its own. :-) --bb |