Dual Code

Mathematically, the dual code of a given linear code is easy to specify: simply construct the linear code whose generator matrix is a parity check matrix of the original code. However, much more interesting is it that the dual code of a nice code is usually a member of a similarly nice family. This should be implemented such that Code.dual_code returns an corresponding object of this nice family with as much information as possible computed and carried over.

Examples include:

• Generalised Reed-Solomon -> Dual is also GRS
• Alternant -> Dual is also alternant
• Goppa -> Dual is alternant
• Hamming -> Dual is 1st order Reed-Muller
• BCH -> Dual is alternant
• Evaluation style Algebraic-Geometric -> Dual is differential-style A-G, which is also an evaluation style A-G !

And there are many others.

As can be glanced from the above, we will sometimes have problems finding the tightest description of the dual code. For instance, it is easy to compute the alternant code from Alternant.dual_code(), but if we call Goppa.dual_code().dual_code() the result is clearly a Goppa code, but there is no bullet-proof, computationally efficient way of determining this. There might be heuristics, such that if the parity check matrices used for duality are nice enough, we can still succeed.

Updated