Ask Your Question
1

span of matrices over finite fields

asked 2018-08-06 11:53:07 +0100

Parker gravatar image

Hello,

I'd to build the span of some matrices defined over GF(4). However, the function span doesn't fit since it seems to interpret matrices as lists of vectors. I tried the following :

F=GF(4);
n=11;
A=random_matrix(F,n);
B=random_matrix(F,n);
print(span(A,F));
print(span([A,B],F));

None of which gives satisfying results (the second one gives an error). So, I wanted to know if there was a way to properly get a span of matrices in sagemath.

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-08-06 13:10:54 +0100

tmonteil gravatar image

The issue is that matrices are not considered as vectors, so you can flatten them as vectors first:

sage: S = span([vector(A),vector(B)]) ; S
Vector space of degree 121 and dimension 2 over Finite Field in z2 of size 2^2
Basis matrix:
2 x 121 dense matrix over Finite Field in z2 of size 2^2

Given a vector v in such a space, you can make it a matrix as follows:

sage: v = S.random_element()
sage: matrix(n,n,v)

You can check consistency:

sage: matrix(n,n,vector(A)) == A
True
sage: matrix(n,n,vector(B)) == B
True
sage: v in S
True
sage: vector(A) in S
True
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-08-06 11:53:07 +0100

Seen: 1,031 times

Last updated: Aug 06 '18