1 | initial version |
You can use the list
method:
sage: a = random_matrix(ZZ,3)
sage: a
[22 3 0]
[-1 -1 -1]
[ 0 0 -1]
sage: a.list()
[22, 3, 0, -1, -1, -1, 0, 0, -1]
If you want a vector, you can do;
sage: vector(a.list())
(22, 3, 0, -1, -1, -1, 0, 0, -1)
2 | No.2 Revision |
You can use the list
method:
sage: a = random_matrix(ZZ,3)
sage: a
[22 3 0]
[-1 -1 -1]
[ 0 0 -1]
sage: a.list()
[22, 3, 0, -1, -1, -1, 0, 0, -1]
If you want a vector, you can do;
sage: vector(a.list())
(22, 3, 0, -1, -1, -1, 0, 0, -1)
On the other direction, you can do:
sage: M = a.parent()
sage: M
Full MatrixSpace of 3 by 3 dense matrices over Integer Ring
sage: M(a.list())
[22 3 0]
[-1 -1 -1]
[ 0 0 -1]
sage: M(a.list()) == a
True