On 5/11/06, Bill Baxter <wbaxter@gmail.com> wrote:
Ahh, I hadn't noticed the fromstring/fromfile methods.

Hmm.  That seems ok for making a row-at-a-time, but it doesn't support the full syntax of the matrix string constructor,  which allows for things like

>>> numpy.matrix("[1 2; 2 3;3 4]")
matrix([[1, 2],
       [2, 3],
       [3, 4]])

You can reshape the array returned by fromstring, i.e.,

In [6]: fromstring("1 2 2 3 3 4", sep=" ").reshape(-1,2)
Out[6]:
array([[1, 2],
       [2, 3],
       [3, 4]])

Chuck