Unflatten a vector
I have a vector say a 9×1 vector which looks like [2x+1x1xx2+2x2xx2x20] with entries in F3[x].
There are 9 rows in this matrix and i want to write a function which takes an n2×1 matrix and turns it into a n×n matrix. So, in this case, we want the function would turn the above vector into
[2x+1x1xx2+2x2xx2x20]
In this Sage, I tried this:
sage: v = Matrix(GF(3)[x], [[2*x+1],[x],[1],[x],[x^2+2*x],[2*x],[x],[2*x^2],[0]])
Then, write the following:
sage: Matrix(v.base_ring(), 3, 3, v)
This gave an error:
inconsistent number of rows: should be 3 but got 1