INSTRUCTIONS

 

Download the file subcodes.m and on Magma first, enter the cardinality of the base field where the cyclic code is defined, like
q:=2;, q:=64; or q:=3^10; etc.

In the next line, enter an integer value for n, e.g.
n:=6; n:=18;
or as a product of prime powers like
n:=2^2*3*5^2;
which will set the code length as q^n-1. Note that the program works for n's which has up to three prime factors.
 
Now enter the powers of the basic zeros of the cyclic code (i.e. the powers of the primitive roots in the trace representation of the code) you want to work with, in the form
i:=[1]; i:=[1,2]; i:=[1,3,5];
and go to the next step. Note that the program works for maximum three distinct basic zeros.

If you want to calculate the QC subcodes of a cyclic code that you would like to define on Magma manually, like
C:=CyclicCode(n,T,K); C:=BCHCode(F,n,d); QRCode(K,n); C:=HammingCode(K,r);
etc., then please download the add-on basiczeros.m, which will compute the powers of the basic zeros of the cyclic code you entered. Please make sure that the cyclic code is of length q^n-1. After defining your code, write
                                load "basiczeros.m";
on the next line and press enter. If the number of zeros is more than 3 then you will get an alert to try another cyclic code. Otherwise, go to the next step.

Write
load "subcodes.m";
and get the results.
Important note: If  load "subcodes.m"; or  load "basiczeros.m"; command does not work, then save the downloaded files to the Magma directory (e.g. Computer --> Program Files --> Magma) and try again, or try by giving the path like
load "C:\\Users\Desktop\subcodes.m";
Note that you can always do Right click --> Open with --> Notepad to open the program in a text format, then copy the whole text and paste it to Magma to run.

Here are some examples of execution:

1) To calculate the QC subcodes of the binary simplex code of length 15, you may use one of the following equivalent commands:
q:=2;
n:=4;
i:=[1];
load "subcodes.m";


q:=2;
n:=4;
C:=SimplexCode(4);
load "basiczeros.m";
load "subcodes.m";


q:=2;
n:=4;
C:=Dual(HammingCode(GF(2),4));
load "basiczeros.m";
load "subcodes.m";


2) For the dual of binary double error correcting BCH code of length 63, you have the following options giving the same result:

q:=2;
n:=6;
i:=[1,3];
load "subcodes.m";

q:=2;
n:=6;
C:=Dual(BCHCode(GF(2),63,5));
load "basiczeros.m";
load "subcodes.m";