Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here's my shot at it. Not very different from your code, but all your spaces are represented by a VectorSpace object, now.

n, i = 4, 1

Kn = GF(2^n,'x')
Vn = Kn.vector_space()
Kn_1.<x> = GF(2^(n+1))
Vn_1 = Kn_1.vector_space() 

f = lambda x: Vn_1(Kn_1(x)^(2^i)) + x
pi = Vn_1.hom(map(f, Vn_1.basis()))
H_u = pi.image()

h1 = Hom(Vn_1, H_u)(random_matrix(GF(2), n+1, n))
h2 = Hom(H_u, Vn)(random_matrix(GF(2), n))

Be careful that vector spaces homomorphisms are represented by matrices multiplied on the left.