Ask Your Question

Revision history [back]

You can do the following if v is a $1 \times 3^2$ matrix (as in your example):

Matrix([vector(v[3*k:3*k+3,0].transpose()) for k in range(3)])

Or more easily, if v is a vector with $3^2$ components:

v = vector(GF(3)[x], [2*x+1,x,1,x,x^2+2*x,2*x,x,2*x^2,0])
Matrix([v[3*k:3*k+3] for k in range(3)])

You can do the following if v is a $1 $3^2 \times 3^2$ 1$ matrix (as in your example):

Matrix([vector(v[3*k:3*k+3,0].transpose()) for k in range(3)])

Or more easily, if v is a vector with $3^2$ components:

v = vector(GF(3)[x], [2*x+1,x,1,x,x^2+2*x,2*x,x,2*x^2,0])
Matrix([v[3*k:3*k+3] for k in range(3)])