2
  1. Let $L$ be an $[n,k]$ code. A $k\times n$ matrix $G$ whose rows form a basis for $L$ is called a generator matrix for $L$.

  2. A linear $[n,k,d]$ code with largest possible minimum distance is called maximum distance $d$ separable or MDS code.

I want to find a generator matrix for MDS code using SageMath or in another way, is there any SageMath code to check a matrix is a generator matrix for the MDS code. Any help with the SageMath code for the generator matrix will be appreciated.

Ievgeni
  • 2,653
  • 1
  • 13
  • 35
Laba Sa
  • 23
  • 4

1 Answers1

2

You can use LinearCode (with the generator matrix as the argument):

sage: C = LinearCode(random_matrix(GF(11), 3, 7))                                                                                                                                                                                              
sage: C.minimum_distance()                                                                                                                                                                                                                     
4

However, for general codes (e.g. random codes), finding the minimum distance (and checking if it's MDS) is a hard problem. Therefore, you can only do it for small matrices.

To generate an MDS matrix, you can use concrete constructions, such as the Cauchy matrix. The generator matrix of the associated linear code can be obtained by concatenating it with the identity matrix.

Fractalice
  • 3,107
  • 13
  • 10