From: Bill B. <wb...@gm...> - 2006-08-30 21:18:38
|
On 8/30/06, Sven Schreiber <sve...@gm...> wrote: > Mathew Yeates schrieb: > will be a numpy matrix, use <asarray> if you don't like that. But here > it's really nice to work with matrices, because otherwise .sum() will > give you a 1-d array sometimes, and that will suddenly look like a row > to <hstack> (instead of a nice column vector) and wouldn't work -- > that's why matrices are so great and everybody should be using them ;-) column_stack would work perfectly in place of hstack there if it only didn't have the silly behavior of transposing arguments that already are 2-d. For reminders, here's the replacement implementation of column_stack I proposed on July 21: def column_stack(tup): def transpose_1d(array): if array.ndim<2: return _nx.transpose(atleast_2d(array)) else: return array arrays = map(transpose_1d,map(atleast_1d,tup)) return _nx.concatenate(arrays,1) This was in a big ticket I submitted about overhauling r_,c_,etc, which was largely ignored. Maybe I should resubmit this by itself... --bb |