# vectorization of a matrix

In Python NumPy arrays implement the 'flatten' method (although this stacks the rows of the matrix, not the columns)

```
sage: A
array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
sage: A.flatten()
array([1, 2, 3, 4, 5, 6, 7, 8, 9])
sage: A.T.flatten()
array([1, 4, 7, 2, 5, 8, 3, 6, 9])
```

In OCTAVE

```
octave: A
A =
8 1 6
3 5 7
4 9 2
octave: A(:)'
ans =
8 3 4 1 5 9 6 7 2
```

Is there a direct method .vectorize() of a matrix in SAGE?

Thanks in advance!