This is CodingTheory.info, produced by Macaulay2, version 1.24.11

CodingTheory -- tools for Coding Theory
***************************************

Description
===========

CodingTheory is a package designed to provide basic coding theory objects, and
methods for computing the basic parameters of linear codes. Some of the
implemented functions use commutative algebra techniques.

CodingTheory currently provides constructors for linear codes and evaluation
codes, and a few methods for each.

Contributors
============

Branden Stone generously contributed code or worked on our code at various
Macaulay2 workshops.

Authors
=======

  * Taylor Ball <trball13@gmail.com>
  * Eduardo Camps <camps@esfm.ipn.mx>
  * Henry Chimal-Dzul <hc118813@ohio.edu>
  * Delio Jaramillo-Velez <djaramillo@math.cinvestav.mx>
  * Hiram H. Lopez <h.lopezvaldez@csuohio.edu>
  * Nathan Nichols <nathannichols454@gmail.com>
  * Matthew Perkins <m.r.perkins73@vikes.csuohio.edu>
  * Ivan Soprunov <i.soprunov@csuohio.edu>
  * German Vera <gveram1100@alumno.ipn.mx>
  * Gwyn Whieldon <gwyn.whieldon@gmail.com>

Certification a gold star
=========================

Version 1.0 of this package was accepted for publication in volume 11 (see
https://msp.org/jsag/2021/11-1/ ) of The Journal of Software for Algebra and
Geometry (see https://msp.org/jsag/ ) on 10 August 2021, in the article Coding
theory package for Macaulay2 (see https://msp.org/jsag/2021/11-1/p11.xhtml )
(DOI: 10.2140/jsag.2021.11.113 (see https://doi.org/10.2140/jsag.2021.11.113
)). That version can be obtained from the journal (see
https://msp.org/jsag/2021/11-1/jsag-v11-n1-x11-CodingTheory.m2 ) or from the
Macaulay2 source code repository (see
https://github.com/Macaulay2/M2/blob/9224486f3fc4b8e00e883570756ab969be351009/
M2/Macaulay2/packages/CodingTheory.m2 ).

Version
=======

This documentation describes version 1.0 of CodingTheory.

Source code
===========

The source code from which this documentation is derived is in the file
CodingTheory.m2 (see common/share/Macaulay2/CodingTheory.m2 ).

Exports
=======

  * Types
      * EvaluationCode -- class of evaluation codes
      * LinearCode -- class of linear codes
  * Functions and commands
      * alphabet -- elements of the base ring of a code
      * ambientSpace -- recovers the ambient module of a
        code
      * bitflipDecode -- an experimental implementation
        of a message passing decoder
      * cartesianCode -- Cartesian code
      * chooseStrat -- Estimate the optimal strategy to
        compute the minimum weight of a linear code.
      * codewords -- codewords of the code
      * cyclicCode -- cyclic codes
      * cyclicMatrix -- cyclic matrix
      * dualCode -- dual of a code
      * enumerateVectors -- a particular way to
        enumerate vectors over a finite field
      * evaluationCode -- functions to construct
        evaluation codes over Galois fields
      * evCodeGraph -- Reed–Muller-type code over a graph
      * field -- the field of a code
      * footPrint -- generalized footprint function of an
        ideal
      * generatorToParityCheck -- parity check
        matrix of a linear code
      * genericCode -- ambient space of a code
      * genMinDisIdeal -- generalized minimum distance
        function of an ideal
      * getLRCencodingPolynomial -- encoding
        polynomial for an LRC code
      * hammingCode -- generates a Hamming code
      * hyp -- hyp function of an ideal
      * informationRate -- information rate of a code
      * linearCode -- functions to construct linear codes
        over Galois fields
      * locallyRecoverableCode -- constructs a
        locally recoverable code (LRC)
      * messages -- set of messages to be encoded by a code
      * minimumWeight -- computes the minimum weight of a
        linear code
      * orderCode -- computes an order code for a given
        weight
      * parityCheckToGenerator -- generator
        matrix given a parity check matrix
      * quasiCyclicCode -- constructs a quasi-cyclic
        code
      * randLDPC -- low density parity check matrix
      * randNoRepeats -- list of random integers from a
        specified range with no repetitions
      * randomCode -- constructs a random linear code over a
        finite field
      * reducedMatrix -- reduced matrix
      * reedMullerCode -- constructs the Reed-Muller
        code
      * reedSolomonCode -- constructs the Reed-Solomon
        code
      * repetitionCode -- repetition code
      * shorten -- shortens a code
      * shortestPath -- shorthest path in a digraph
      * syndromeDecode -- syndrome decoding on a code
      * tannerGraph -- outputs the tanner graph associated
        with the given parity check matrix
      * toricCode -- a toric code construction
      * universeCode -- linear code
        $\mathtt{F}^\mathtt{n}$
      * vasconcelosDegree -- Vasconcelos function of
        an ideal
      * vectorSpace -- vector space of a code
      * vNumber -- the v-number of a graded ideal
      * weight -- Hamming weight of a list
      * zeroCode -- zero code
      * zeroSumCode -- linear code in which the entries of
        each codeword add up zero
  * Methods
      * "alphabet(LinearCode)" -- see alphabet, -- elements of
        the base ring of a code
      * "ambientSpace(LinearCode)" -- see ambientSpace, --
        recovers the ambient module of a code
      * "bitflipDecode(Matrix,Vector,ZZ)" -- see bitflipDecode,
        -- an experimental implementation of a message passing
        decoder
      * "cartesianCode(Ring,List,List)" -- see cartesianCode,
        -- Cartesian code
      * "cartesianCode(Ring,List,Matrix)" -- see cartesianCode,
        -- Cartesian code
      * "cartesianCode(Ring,List,ZZ)" -- see cartesianCode,
        -- Cartesian code
      * "chooseStrat(LinearCode)" -- see chooseStrat, --
        Estimate the optimal strategy to compute the minimum weight of a linear
        code.
      * "codewords(LinearCode)" -- see codewords, -- codewords
        of the code
      * "cyclicCode(GaloisField,RingElement,ZZ)" -- see cyclicCode,
        -- cyclic codes
      * "cyclicCode(GaloisField,ZZ,ZZ)" -- see cyclicCode, --
        cyclic codes
      * "cyclicMatrix(GaloisField,List)" -- see cyclicMatrix,
        -- cyclic matrix
      * "cyclicMatrix(List)" -- see cyclicMatrix, -- cyclic
        matrix
      * dim(LinearCode) -- dimension of a linear
        code
      * "dualCode(LinearCode)" -- see dualCode, -- dual of a
        code
      * "enumerateVectors(Ring,List)" -- see enumerateVectors,
        -- a particular way to enumerate vectors over a
        finite field
      * "evaluationCode(Ring,List,List)" -- see evaluationCode,
        -- functions to construct evaluation codes over Galois
        fields
      * "evaluationCode(Ring,List,Matrix)" -- see evaluationCode,
        -- functions to construct evaluation codes over Galois
        fields
      * "evCodeGraph(Ring,Matrix,List)" -- see evCodeGraph,
        -- Reed–Muller-type code over a graph
      * "field(LinearCode)" -- see field, -- the field of a code
      * "footPrint(ZZ,ZZ,Ideal)" -- see footPrint, --
        generalized footprint function of an ideal
      * "generatorToParityCheck(Matrix)" -- see generatorToParityCheck,
        -- parity check matrix of a linear code
      * "genericCode(LinearCode)" -- see genericCode, --
        ambient space of a code
      * "genMinDisIdeal(ZZ,ZZ,Ideal)" -- see genMinDisIdeal,
        -- generalized minimum distance function of an ideal
      * "getLRCencodingPolynomial(ZZ,ZZ,List,RingElement)" -- see
        getLRCencodingPolynomial, -- encoding
        polynomial for an LRC code
      * "hammingCode(ZZ,ZZ)" -- see hammingCode, --
        generates a Hamming code
      * "hyp(ZZ,ZZ,Ideal)" -- see hyp, -- hyp function of an ideal
      * "informationRate(LinearCode)" -- see informationRate,
        -- information rate of a code
      * length(LinearCode) -- returns the length
        of a linear code
      * "linearCode(GaloisField,List)" -- see linearCode, --
        functions to construct linear codes over Galois fields
      * "linearCode(GaloisField,ZZ,List)" -- see linearCode,
        -- functions to construct linear codes over Galois fields
      * "linearCode(Matrix)" -- see linearCode, -- functions
        to construct linear codes over Galois fields
      * "linearCode(Module)" -- see linearCode, -- functions
        to construct linear codes over Galois fields
      * "linearCode(Module,List)" -- see linearCode, --
        functions to construct linear codes over Galois fields
      * "linearCode(ZZ,ZZ,ZZ,List)" -- see linearCode, --
        functions to construct linear codes over Galois fields
      * LinearCode == LinearCode -- determines
        if two linear codes are equal
      * "locallyRecoverableCode(List,List,RingElement)" -- see
        locallyRecoverableCode, -- constructs a locally
        recoverable code (LRC)
      * "messages(LinearCode)" -- see messages, -- set of
        messages to be encoded by a code
      * "minimumWeight(LinearCode)" -- see minimumWeight,
        -- computes the minimum weight of a linear code
      * "orderCode(Ideal,List,List,ZZ)" -- see orderCode, --
        computes an order code for a given weight
      * "orderCode(Ideal,List,ZZ)" -- see orderCode, --
        computes an order code for a given weight
      * "orderCode(Ring,List,List,ZZ)" -- see orderCode, --
        computes an order code for a given weight
      * "parityCheckToGenerator(Matrix)" -- see parityCheckToGenerator,
        -- generator matrix given a parity check matrix
      * "quasiCyclicCode(GaloisField,List)" -- see quasiCyclicCode,
        -- constructs a quasi-cyclic code
      * "quasiCyclicCode(List)" -- see quasiCyclicCode,
        -- constructs a quasi-cyclic code
      * "randLDPC(ZZ,ZZ,RR,ZZ)" -- see randLDPC, -- low density
        parity check matrix
      * "randNoRepeats(ZZ,ZZ)" -- see randNoRepeats, --
        list of random integers from a specified range with no repetitions
      * "randomCode(GaloisField,ZZ,ZZ)" -- see randomCode, --
        constructs a random linear code over a finite field
      * "randomCode(QuotientRing,ZZ,ZZ)" -- see randomCode,
        -- constructs a random linear code over a finite field
      * "reducedMatrix(Matrix)" -- see reducedMatrix, --
        reduced matrix
      * "reedMullerCode(ZZ,ZZ,ZZ)" -- see reedMullerCode,
        -- constructs the Reed-Muller code
      * "reedSolomonCode(Ring,List,ZZ)" -- see reedSolomonCode,
        -- constructs the Reed-Solomon code
      * "repetitionCode(GaloisField,ZZ)" -- see repetitionCode,
        -- repetition code
      * ring(LinearCode) -- the ring of a code
      * "shorten(LinearCode,List)" -- see shorten, -- shortens a
        code
      * "shorten(LinearCode,ZZ)" -- see shorten, -- shortens a
        code
      * "shortestPath(Digraph,Thing,List)" -- see shortestPath,
        -- shorthest path in a digraph
      * size(LinearCode) -- gives the number of
        codewords in a linear code
      * "syndromeDecode(LinearCode,Matrix,ZZ)" -- see syndromeDecode,
        -- syndrome decoding on a code
      * "tannerGraph(Matrix)" -- see tannerGraph, -- outputs
        the tanner graph associated with the given parity check matrix
      * "toricCode(Ring,Matrix)" -- see toricCode, -- a toric
        code construction
      * toString(LinearCode) -- string with
        the vectors of a generator matrix of a code
      * "universeCode(GaloisField,ZZ)" -- see universeCode,
        -- linear code $\mathtt{F}^\mathtt{n}$
      * "vasconcelosDegree(ZZ,ZZ,Ideal)" -- see vasconcelosDegree,
        -- Vasconcelos function of an ideal
      * "vectorSpace(LinearCode)" -- see vectorSpace, --
        vector space of a code
      * "vNumber(Ideal)" -- see vNumber, -- the v-number of a
        graded ideal
      * "weight(BasicList)" -- see weight, -- Hamming weight of a
        list
      * "zeroCode(GaloisField,ZZ)" -- see zeroCode, -- zero
        code
      * "zeroSumCode(GaloisField,ZZ)" -- see zeroSumCode, --
        linear code in which the entries of each codeword add up zero
  * Symbols
      * AmbientModule -- the ambient module of a code
      * BaseField -- the field of a code
      * Code -- a code as image
      * ExponentsMatrix -- specifies the matrix of
        exponents
      * GeneratorMatrix -- gives the generator matrix
        of a linear code
      * Generators -- list of generators of a code
      * ParityCheck -- an optional input for the linearCode
        constructor
      * ParityCheckMatrix -- a parity check matrix of
        a code
      * ParityCheckRows -- rows of a parity check
        matrix of a code
      * PolynomialSet -- a set of polynomials for an
        evaluation code
      * Sets -- sets of a Cartesian code
      * Strat -- Specify the algorithm used to perform a minimum
        weight computation.
      * VanishingIdeal -- vanishing ideal of an
        evaluation code

For the programmer
==================

The object CodingTheory, is a package (Macaulay2Doc).

Main objects

Modified methods

Implemented functions that are independent of coding theory

EvaluationCode -- class of evaluation codes
*******************************************

Description
===========

EvaluationCode is the class of linear codes obtained by evaluating polynomials
in $F[X_1,\ldots,X_m]$, where $F$ is a finite field, at a set of points in
$F^m$. There are various constructions of evaluation codes depending on how the
polynomials and points are chosen. Important examples include Reed-Solomon
codes, Reed-Muller codes, monomial codes, Cartesian codes, and toric codes. To
construct a linear code, see evaluationCode.

The basic structure is a hash table. One of the values is the resulting linear
code of type LinearCode. Other values include the set of
points, its vanishing ideal, the set of polynomials, and more.

+-----------------------------------------------------------------------------+
|i1 : F=GF(4);                                                                |
+-----------------------------------------------------------------------------+
|i2 : R=F[x,y];                                                               |
+-----------------------------------------------------------------------------+
|i3 : P={{0,0},{1,0},{0,1},{a,a}};                                            |
+-----------------------------------------------------------------------------+
|i4 : S={x+y,x^2+y^2, a+x*y^2};                                               |
+-----------------------------------------------------------------------------+
|i5 : C=evaluationCode(F,P,S);                                                |
+-----------------------------------------------------------------------------+
|i6 : C.VanishingIdeal                                                        |
|                                                                             |
|                          2              2    2                              |
|o6 = ideal (x*y + (a + 1)y  + (a + 1)y, x  + y  + x + y)                     |
|                                                                             |
|o6 : Ideal of R                                                              |
+-----------------------------------------------------------------------------+
|i7 : C.PolynomialSet                                                         |
|                                                                             |
|              2    2     2                                                   |
|o7 = {x + y, x  + y , x*y  + a}                                              |
|                                                                             |
|o7 : List                                                                    |
+-----------------------------------------------------------------------------+
|i8 : C.LinearCode                                                            |
|                                                                             |
|                                  4                                          |
|o8 = LinearCode{AmbientModule => F                                          }|
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                Code => image | 0 0 a   |                                    |
|                              | 1 1 a   |                                    |
|                              | 1 1 a   |                                    |
|                              | 0 0 a+1 |                                    |
|                GeneratorMatrix => | 0 1 1 0   |                             |
|                                   | 0 1 1 0   |                             |
|                                   | a a a a+1 |                             |
|                Generators => {{0, 1, 1, 0}, {0, 1, 1, 0}, {a, a, a, a + 1}} |
|                ParityCheckMatrix => | 1 0 0 a+1 |                           |
|                                     | 0 1 1 0   |                           |
|                ParityCheckRows => {{1, 0, 0, a + 1}, {0, 1, 1, 0}}          |
|                                                                             |
|o8 : LinearCode                                                              |
+-----------------------------------------------------------------------------+
|i9 : length C.LinearCode                                                     |
|                                                                             |
|o9 = 4                                                                       |
+-----------------------------------------------------------------------------+
|i10 : dim C.LinearCode                                                       |
|                                                                             |
|o10 = 2                                                                      |
+-----------------------------------------------------------------------------+

Functions and methods returning an object of class EvaluationCode:
==================================================================

  * "cartesianCode(Ring,List,List)" -- see cartesianCode,
    -- Cartesian code
  * "cartesianCode(Ring,List,Matrix)" -- see cartesianCode,
    -- Cartesian code
  * "cartesianCode(Ring,List,ZZ)" -- see cartesianCode, --
    Cartesian code
  * "evaluationCode(Ring,List,List)" -- see evaluationCode,
    -- functions to construct evaluation codes over Galois
    fields
  * "evaluationCode(Ring,List,Matrix)" -- see evaluationCode,
    -- functions to construct evaluation codes over Galois
    fields
  * "orderCode(Ideal,List,List,ZZ)" -- see orderCode, --
    computes an order code for a given weight
  * "orderCode(Ideal,List,ZZ)" -- see orderCode, -- computes
    an order code for a given weight
  * "orderCode(Ring,List,List,ZZ)" -- see orderCode, --
    computes an order code for a given weight
  * reedMullerCode -- constructs the Reed-Muller code
  * "reedMullerCode(ZZ,ZZ,ZZ)" -- see reedMullerCode, --
    constructs the Reed-Muller code
  * reedSolomonCode -- constructs the Reed-Solomon code
  * "reedSolomonCode(Ring,List,ZZ)" -- see reedSolomonCode,
    -- constructs the Reed-Solomon code
  * "toricCode(Ring,Matrix)" -- see toricCode, -- a toric code
    construction

For the programmer
==================

The object EvaluationCode, is a type (Macaulay2Doc),
with ancestor classes HashTable (Macaulay2Doc),
< Thing (Macaulay2Doc).

Functions related to ideals and evaluation codes

Symbols that are used as a key for storing information of an evaluation code

evaluationCode -- functions to construct evaluation codes over Galois fields
****************************************************************************

Synopsis
========

  * Usage:
        evaluationCode(F,P,S)
        evaluationCode(F,P,M)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * P, a list (Macaulay2Doc),
      * S, a list (Macaulay2Doc),
      * M, a matrix (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

Description
===========

We present below the ways in how an evaluation code $C$ can be defined.

a ring and a two lists are given
================================

  * Usage:
        evaluationCode(F,P,S)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * P, a list (Macaulay2Doc),
      * S, a list (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

Given a finite field F, an ordered list P of points in F$^m$, and an ordered
list S of polynomials over F in $m$ variables, this method produces an
EvaluationCode $C$ generated by codewords obtained by evaluating the given
polynomials in S at the given points in P.

+-----------------------------------------------------------------------------+
|i1 : F=GF(4);                                                                |
+-----------------------------------------------------------------------------+
|i2 : R=F[x,y,z];                                                             |
+-----------------------------------------------------------------------------+
|i3 : P={{0,0,0},{1,0,0},{0,1,0},{0,0,1},{1,1,1},{a,a,a}};                    |
+-----------------------------------------------------------------------------+
|i4 : S={x+y+z,a+y*z^2,z^2,x+y+z+z^2};                                        |
+-----------------------------------------------------------------------------+
|i5 : C=evaluationCode(F,P,S)                                                 |
|                                                                             |
|o5 = EvaluationCode{cache => CacheTable{}                                    |
|                                                               6             |
|                    LinearCode => LinearCode{AmbientModule => F              |
|                                             BaseField => F                  |
|                                             cache => CacheTable{}           |
|                                             Code => image | 0 a   0   0 |   |
|                                                           | 1 a   0   1 |   |
|                                                           | 1 a   0   1 |   |
|                                                           | 1 a   1   0 |   |
|                                                           | 1 a+1 1   0 |   |
|                                                           | a a+1 a+1 1 |   |
|                                             GeneratorMatrix => | 0 1 1 1 1  |
|                                                                | a a a a a+1|
|                                                                | 0 0 0 1 1  |
|                                                                | 0 1 1 0 0  |
|                                             Generators => {{0, 1, 1, 1, 1, a|
|                                             ParityCheckMatrix => | 1 0 0 a  |
|                                                                  | 0 1 0 a+1|
|                                                                  | 0 0 1 a+1|
|                                             ParityCheckRows => {{1, 0, 0, a,|
|                    Points => {{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {1|
|                                                    2       2   2            |
|                    PolynomialSet => {x + y + z, y*z  + a, z , z  + x + y + z|
|                                                         2    2              |
|                    VanishingIdeal => ideal (x*z + y*z, y  + z  + y + z, x*y |
|                                                                             |
|o5 : EvaluationCode                                                          |
|-----------------------------------------------------------------------------|
|                                                                           } |
|                                                                             |
|                                                                          }  |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| a   |                                                                       |
| a+1 |                                                                       |
| a+1 |                                                                       |
| 1   |                                                                       |
|}, {a, a, a, a, a + 1, a + 1}, {0, 0, 0, 1, 1, a + 1}, {0, 1, 1, 0, 0, 1}}   |
| a 0 |                                                                       |
| 0 1 |                                                                       |
| 0 1 |                                                                       |
| a, 0}, {0, 1, 0, a + 1, 0, 1}, {0, 0, 1, a + 1, 0, 1}}                      |
|, 1, 1}, {a, a, a}}                                                          |
|                                                                             |
|}                                                                            |
|        2    2           3           2                                       |
|+ y*z, x  + z  + x + z, z  + (a + 1)z  + a*z)                                |
+-----------------------------------------------------------------------------+

a ring, a list and a matrix are given
=====================================

  * Usage:
        evaluationCode(F,P,M)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * P, a list (Macaulay2Doc),
      * M, a matrix (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

Given a finite field F, an ordered list P of points in F$^m$, and a matrix M
with $m$ columns, this method produces a linear code $C$ generated by the
codewords obtained by evaluating the monomials defined by the rows of M at the
given points in P.

+-----------------------------------------------------------------------------+
|i6 : F=GF(4);                                                                |
+-----------------------------------------------------------------------------+
|i7 : R=F[x,y,z];                                                             |
+-----------------------------------------------------------------------------+
|i8 : P={{0,0,0},{1,0,0},{0,1,0},{0,0,1},{1,1,1},{a,a,a}};                    |
+-----------------------------------------------------------------------------+
|i9 : M=matrix{{0,0,1},{1,1,1}};                                              |
|                                                                             |
|              2       3                                                      |
|o9 : Matrix ZZ  <-- ZZ                                                       |
+-----------------------------------------------------------------------------+
|i10 : C=evaluationCode(F,P,M)                                                |
|                                                                             |
|o10 = EvaluationCode{cache => CacheTable{}                                   |
|                                                                6            |
|                     LinearCode => LinearCode{AmbientModule => F             |
|                                              BaseField => F                 |
|                                              cache => CacheTable{}          |
|                                              Code => image | 0 0 |          |
|                                                            | 0 0 |          |
|                                                            | 0 0 |          |
|                                                            | 1 0 |          |
|                                                            | 1 1 |          |
|                                                            | a 1 |          |
|                                              GeneratorMatrix => | 0 0 0 1 1 |
|                                                                 | 0 0 0 0 1 |
|                                              Generators => {{0, 0, 0, 1, 1, |
|                                              ParityCheckMatrix => | 1 0 0 0 |
|                                                                   | 0 1 0 0 |
|                                                                   | 0 0 1 0 |
|                                                                   | 0 0 0 1 |
|                                              ParityCheckRows => {{1, 0, 0, 0|
|                     Points => {{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {|
|                     PolynomialSet => {t , t t t }                           |
|                                        2   0 1 2                            |
|                                                            2    2           |
|                     VanishingIdeal => ideal (t t  + t t , t  + t  + t  + t ,|
|                                               0 2    1 2   1    2    1    2 |
|                                                                             |
|o10 : EvaluationCode                                                         |
|-----------------------------------------------------------------------------|
|                                                                     }       |
|                                                                             |
|                                                                    }        |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|a |                                                                          |
|1 |                                                                          |
|a}, {0, 0, 0, 0, 1, 1}}                                                      |
|0 0 |                                                                        |
|0 0 |                                                                        |
|0 0 |                                                                        |
|a a |                                                                        |
|, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, a, a}}         |
|1, 1, 1}, {a, a, a}}                                                         |
|                                                                             |
|                                                                             |
|               2    2             3           2                              |
| t t  + t t , t  + t  + t  + t , t  + (a + 1)t  + a*t )                      |
|  0 1    1 2   0    2    0    2   2           2      2                       |
+-----------------------------------------------------------------------------+

Caveat
======

While this function may work even when a ring is given, instead of a finite
field, it is possible that the results are not the expected ones.

Ways to use evaluationCode:
===========================

  * "evaluationCode(Ring,List,List)"
  * "evaluationCode(Ring,List,Matrix)"

For the programmer
==================

The object evaluationCode, is a method function with options (Macaulay2Doc).

Constructions of evaluation codes

evCodeGraph -- Reed–Muller-type code over a graph
*************************************************

Synopsis
========

  * Usage:
        evCodeGraph(F,M,S)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * M, a matrix (Macaulay2Doc),
      * S, a list (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

Description
===========

Given a finite field F, an incidence matrix M of a connected graph $G$, and an
ordered list S of polynomials over F, this method produces an EvaluationCode
$C$ generated by evaluating the given polynomials in S at the columns of the
matrix M.

+-----------------------------------------------------------------------------+
|i1 : G = graph({1,2,3,4}, {{1,2},{2,3},{3,4},{4,3}});                        |
+-----------------------------------------------------------------------------+
|i2 : B=incidenceMatrix G;                                                    |
|                                                                             |
|              4       3                                                      |
|o2 : Matrix ZZ  <-- ZZ                                                       |
+-----------------------------------------------------------------------------+
|i3 : S=ZZ/2[t_(0)..t_(#vertexSet G-1)];                                      |
+-----------------------------------------------------------------------------+
|i4 : Y=evCodeGraph(coefficientRing S,B,flatten entries basis(1,S))           |
|                                                                             |
|                                      ZZ 3                                   |
|o4 = EvaluationCode{AmbientModule => (--)                                    |
|                                       2                                     |
|                    cache => CacheTable{}                                    |
|                                                               ZZ 4          |
|                    LinearCode => LinearCode{AmbientModule => (--)           |
|                                                                2            |
|                                                          ZZ                 |
|                                             BaseField => --                 |
|                                                           2                 |
|                                             cache => CacheTable{}           |
|                                             Code => image | 1 0 0 |         |
|                                                           | 1 1 0 |         |
|                                                           | 0 1 1 |         |
|                                                           | 0 0 1 |         |
|                                             GeneratorMatrix => | 1 1 0 0 |  |
|                                                                | 0 1 1 0 |  |
|                                                                | 0 0 1 1 |  |
|                                             Generators => {{1, 1, 0, 0}, {0 |
|                                             ParityCheckMatrix => | 1 1 1 1  |
|                                             ParityCheckRows => {{1, 1, 1, 1 |
|                    Points => {{1, 1, 0, 0}, {0, 1, 1, 0}, {0, 0, 1, 1}}     |
|                    PolynomialSet => {t  + 1, t , t , t }                    |
|                                       2       1   2   3                     |
|                                                           2                 |
|                    VanishingIdeal => ideal (t  + t  + 1, t  + t , t t  + t  |
|                                              0    2       2    2   1 2    1 |
|                                                                             |
|o4 : EvaluationCode                                                          |
|-----------------------------------------------------------------------------|
|                          }                                                  |
|                                                                             |
|                                                                             |
|                                                                             |
|                         }                                                   |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|, 1, 1, 0}, {0, 0, 1, 1}}                                                    |
||                                                                            |
|}}                                                                           |
|                                                                             |
|                                                                             |
|                                                                             |
|            2                                                                |
| + t  + 1, t  + t )                                                          |
|    2       1    1                                                           |
+-----------------------------------------------------------------------------+

Caveat
======

While this function may work even when a ring is given, instead of a finite
field, it is possible that the results are not the expected ones.

Ways to use evCodeGraph:
========================

  * "evCodeGraph(Ring,Matrix,List)"

For the programmer
==================

The object evCodeGraph, is a method function with options (Macaulay2Doc).

cartesianCode -- Cartesian code
*******************************

Synopsis
========

  * Usage:
        cartesianCode(F,L,d)
        cartesianCode(F,L,S)
        cartesianCode(F,L,M)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
      * S, a list (Macaulay2Doc),
      * d, an integer (Macaulay2Doc),
      * M, a matrix (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

Description
===========

We present below the ways in how a Cartesian code $C$ can be defined.

a ring, a list and an integer are given
=======================================

  * Usage:
        cartesianCode(F, L, d)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
      * d, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

F is a field, L  is a list of subsets of F and d is an integer. Returns the
Cartesian code $C$ obtained when polynomials of degree at most d are evaluated
over the points of the Cartesian product made by the subsets of L.

+-----------------------------------------------------------------------------+
|i1 : C=cartesianCode(ZZ/11,{{1,2,3},{2,6,8}},3)                              |
|                                                                             |
|o1 = EvaluationCode{cache => CacheTable{}                                    |
|                                                               ZZ 9          |
|                    LinearCode => LinearCode{AmbientModule => (--)           |
|                                                               11            |
|                                                          ZZ                 |
|                                             BaseField => --                 |
|                                                          11                 |
|                                             cache => CacheTable{}           |
|                                             Code => image | 1 1 1  1  -5 -5 |
|                                                           | 1 2 4  -3 2  1  |
|                                                           | 1 3 -2 5  -1 -4 |
|                                                           | 1 1 1  1  -3 -3 |
|                                                           | 1 2 4  -3 -1 5  |
|                                                           | 1 3 -2 5  -5 2  |
|                                                           | 1 1 1  1  2  2  |
|                                                           | 1 2 4  -3 -3 4  |
|                                                           | 1 3 -2 5  -4 -5 |
|                                             GeneratorMatrix => | 1  1  1  1 |
|                                                                | 1  2  3  1 |
|                                                                | 1  4  -2 1 |
|                                                                | 1  -3 5  1 |
|                                                                | -5 2  -1 - |
|                                                                | -5 1  -4 - |
|                                                                | 3  -5 -2 - |
|                                                                | -5 -5 -5 - |
|                                                                | 3  3  3  - |
|                                                                | -4 -4 -4 - |
|                                             Generators => {{1, 1, 1, 1, 1,  |
|                                             ParityCheckMatrix => | 1 -2 1 3 |
|                                             ParityCheckRows => {{1, -2, 1,  |
|                    Points => {{1, 6}, {2, 6}, {3, 6}, {1, 8}, {2, 8}, {3, 8 |
|                                              2   3   2             2        |
|                    PolynomialSet => {1, t , t , t , t t , t t , t t , t , t |
|                                          0   0   0   0 1   0 1   0 1   1    |
|                    Sets => {{1, 2, 3}, {2, 6, 8}}                           |
|                                              3     2       3     2          |
|                    VanishingIdeal => ideal (t  + 5t  + 5, t  - 5t  - t  + 3 |
|                                              0     0       1     1    1     |
|                                                                             |
|o1 : EvaluationCode                                                          |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 3  -5 3  -4 |                                                               |
| -5 -5 3  -4 |                                                               |
| -2 -5 3  -4 |                                                               |
| -2 -3 -2 -5 |                                                               |
| -4 -3 -2 -5 |                                                               |
| 5  -3 -2 -5 |                                                               |
| 4  2  4  -3 |                                                               |
| -3 2  4  -3 |                                                               |
| 1  2  4  -3 |                                                               |
|  1  1  1  1  1  |                                                           |
|  2  3  1  2  3  |                                                           |
|  4  -2 1  4  -2 |                                                           |
|  -3 5  1  -3 5  |                                                           |
|3 -1 -5 2  -3 -4 |                                                           |
|3 5  2  2  4  -5 |                                                           |
|2 -4 5  4  -3 1  |                                                           |
|3 -3 -3 2  2  2  |                                                           |
|2 -2 -2 4  4  4  |                                                           |
|5 -5 -5 -3 -3 -3 |                                                           |
|1, 1, 1, 1}, {1, 2, 3, 1, 2, 3, 1, 2, 3}, {1, 4, -2, 1, 4, -2, 1, 4, -2}, {1,|
| 5 3 -4 -3 -4 |                                                              |
|3, 5, 3, -4, -3, -4}}                                                        |
|}, {1, 2}, {2, 2}, {3, 2}}                                                   |
|2   3                                                                        |
| , t }                                                                       |
|1   1                                                                        |
|                                                                             |
|                                                                             |
|)                                                                            |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-3, 5, 1, -3, 5, 1, -3, 5}, {-5, 2, -1, -3, -1, -5, 2, -3, -4}, {-5, 1, -4,  |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-3, 5, 2, 2, 4, -5}, {3, -5, -2, -2, -4, 5, 4, -3, 1}, {-5, -5, -5, -3, -3,  |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-3, 2, 2, 2}, {3, 3, 3, -2, -2, -2, 4, 4, 4}, {-4, -4, -4, -5, -5, -5, -3,   |
|-----------------------------------------------------------------------------|
|         }                                                                   |
|                                                                             |
|        }                                                                    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-3, -3}}                                                                     |
+-----------------------------------------------------------------------------+

a ring and two lists are given
==============================

  * Usage:
        cartesianCode(F, L, S)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
      * S, a list (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

F is a field, L  is a list of subsets of F and S is a set of polynomials.
Returns the Cartesian code $C$ obtained when polynomials in the list S are
evaluated over the points of the Cartesian product made by the subsets of L.

+-----------------------------------------------------------------------------+
|i2 : F=GF(4);                                                                |
+-----------------------------------------------------------------------------+
|i3 : R=F[x,y];                                                               |
+-----------------------------------------------------------------------------+
|i4 : C=cartesianCode(F,{{0,1,a},{0,1,a}},{1+x+y,x*y})                        |
|                                                                             |
|o4 = EvaluationCode{cache => CacheTable{}                                    |
|                                                               9             |
|                    LinearCode => LinearCode{AmbientModule => F              |
|                                             BaseField => F                  |
|                                             cache => CacheTable{}           |
|                                             Code => image | 1   0   |       |
|                                                           | 0   0   |       |
|                                                           | 0   0   |       |
|                                                           | 1   1   |       |
|                                                           | a+1 0   |       |
|                                                           | a+1 0   |       |
|                                                           | a   a   |       |
|                                                           | a   a   |       |
|                                                           | 1   a+1 |       |
|                                             GeneratorMatrix => | 1 0 0 1 a+ |
|                                                                | 0 0 0 1 0  |
|                                             Generators => {{1, 0, 0, 1, a + |
|                                             ParityCheckMatrix => | 1 0 0 0  |
|                                                                  | 0 1 0 0  |
|                                                                  | 0 0 1 0  |
|                                                                  | 0 0 0 1  |
|                                                                  | 0 0 0 0  |
|                                                                  | 0 0 0 0  |
|                                                                  | 0 0 0 0  |
|                                             ParityCheckRows => {{1, 0, 0, 0 |
|                    Points => {{0, 0}, {1, 0}, {0, 1}, {1, 1}, {a, 0}, {0, a |
|                    PolynomialSet => {x + y + 1, x*y}                        |
|                    Sets => {{0, 1, a}, {0, 1, a}}                           |
|                                              3           2         3        |
|                    VanishingIdeal => ideal (x  + (a + 1)x  + a*x, y  + (a + |
|                                                                             |
|o4 : EvaluationCode                                                          |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1 a+1 a a 1   |                                                              |
|  0   a a a+1 |                                                              |
| 1, a + 1, a, a, 1}, {0, 0, 0, 1, 0, 0, a, a, a + 1}}                        |
|0 0 1   0 a+1 |                                                              |
|0 0 0   0 0   |                                                              |
|0 0 0   0 0   |                                                              |
|0 0 a+1 0 0   |                                                              |
|1 0 a+1 0 a   |                                                              |
|0 1 a+1 0 a   |                                                              |
|0 0 1   1 0   |                                                              |
|, 0, 0, 1, 0, a + 1}, {0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0,  |
|}, {1, a}, {a, 1}, {a, a}}                                                   |
|                                                                             |
|                                                                             |
|    2                                                                        |
| 1)y  + a*y)                                                                 |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {0, 0, 0, 1, 0, 0, a + 1, 0, 0}, {0, 0, 0, 0, 1, 0, a + 1, 0, a}, {0, 0, |
|-----------------------------------------------------------------------------|
|                                                       }                     |
|                                                                             |
|                                                      }                      |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0, 0, 0, 1, a + 1, 0, a}, {0, 0, 0, 0, 0, 0, 1, 1, 0}}                       |
+-----------------------------------------------------------------------------+
|i5 : C.LinearCode                                                            |
|                                                                             |
|                                  9                                          |
|o5 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                Code => image | 1   0   |                                    |
|                              | 0   0   |                                    |
|                              | 0   0   |                                    |
|                              | 1   1   |                                    |
|                              | a+1 0   |                                    |
|                              | a+1 0   |                                    |
|                              | a   a   |                                    |
|                              | a   a   |                                    |
|                              | 1   a+1 |                                    |
|                GeneratorMatrix => | 1 0 0 1 a+1 a+1 a a 1                   |
|                                   | 0 0 0 1 0   0   a a a+1                 |
|                Generators => {{1, 0, 0, 1, a + 1, a + 1, a,                 |
|                ParityCheckMatrix => | 1 0 0 0 0 0 1   0 a+1                 |
|                                     | 0 1 0 0 0 0 0   0 0                   |
|                                     | 0 0 1 0 0 0 0   0 0                   |
|                                     | 0 0 0 1 0 0 a+1 0 0                   |
|                                     | 0 0 0 0 1 0 a+1 0 a                   |
|                                     | 0 0 0 0 0 1 a+1 0 a                   |
|                                     | 0 0 0 0 0 0 1   1 0                   |
|                ParityCheckRows => {{1, 0, 0, 0, 0, 0, 1, 0,                 |
|                                                                             |
|o5 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
||                                                                            |
||                                                                            |
|a, 1}, {0, 0, 0, 1, 0, 0, a, a, a + 1}}                                      |
||                                                                            |
||                                                                            |
||                                                                            |
||                                                                            |
||                                                                            |
||                                                                            |
||                                                                            |
|a + 1}, {0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 0,  |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, 0, 0, a + 1, 0, 0}, {0, 0, 0, 0, 1, 0, a + 1, 0, a}, {0, 0, 0, 0, 0, 1, a |
|-----------------------------------------------------------------------------|
|                                        }                                    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|+ 1, 0, a}, {0, 0, 0, 0, 0, 0, 1, 1, 0}}                                     |
+-----------------------------------------------------------------------------+

a ring, a list and a Matrix are given
=====================================

  * Usage:
        cartesianCode(F, L, M)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
      * M, a matrix (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

F is a field, L is a list of subsets of F and M is the matrix whose rows are
the exponents of the monomials to evaluate. Returns the Cartesian code $C$
obtained when the monomials defined by the matrix M are evaluated over the
points of the Cartesian product made by the subsets of L.

+-----------------------------------------------------------------------------+
|i6 : F=GF(4);                                                                |
+-----------------------------------------------------------------------------+
|i7 : R=F[x,y];                                                               |
+-----------------------------------------------------------------------------+
|i8 : C=cartesianCode(F,{{0,1,a},{0,1,a}},matrix{{1,2},{2,3}})                |
|                                                                             |
|o8 = EvaluationCode{cache => CacheTable{}                                    |
|                                                               9             |
|                    LinearCode => LinearCode{AmbientModule => F              |
|                                             BaseField => F                  |
|                                             cache => CacheTable{}           |
|                                             Code => image | 0   0   |       |
|                                                           | 0   0   |       |
|                                                           | 0   0   |       |
|                                                           | 0   0   |       |
|                                                           | 0   0   |       |
|                                                           | 1   1   |       |
|                                                           | a+1 1   |       |
|                                                           | a   a+1 |       |
|                                                           | 1   a+1 |       |
|                                             GeneratorMatrix => | 0 0 0 0 0  |
|                                                                | 0 0 0 0 0  |
|                                             Generators => {{0, 0, 0, 0, 0,  |
|                                             ParityCheckMatrix => | 1 0 0 0  |
|                                                                  | 0 1 0 0  |
|                                                                  | 0 0 1 0  |
|                                                                  | 0 0 0 1  |
|                                                                  | 0 0 0 0  |
|                                                                  | 0 0 0 0  |
|                                                                  | 0 0 0 0  |
|                                             ParityCheckRows => {{1, 0, 0, 0 |
|                    Points => {{0, 0}, {1, 0}, {0, 1}, {a, 0}, {0, a}, {1, 1 |
|                                         2   2 3                             |
|                    PolynomialSet => {t t , t t }                            |
|                                       0 1   0 1                             |
|                    Sets => {{0, 1, a}, {0, 1, a}}                           |
|                                              3           2          3       |
|                    VanishingIdeal => ideal (t  + (a + 1)t  + a*t , t  + (a  |
|                                              0           0      0   1       |
|                                                                             |
|o8 : EvaluationCode                                                          |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1 a+1 a   1   |                                                              |
|1 1   a+1 a+1 |                                                              |
|1, a + 1, a, 1}, {0, 0, 0, 0, 0, 1, 1, a + 1, a + 1}}                        |
|0 0 0 0 0   |                                                                |
|0 0 0 0 0   |                                                                |
|0 0 0 0 0   |                                                                |
|0 0 0 0 0   |                                                                |
|1 0 0 0 0   |                                                                |
|0 1 0 1 a+1 |                                                                |
|0 0 1 a 0   |                                                                |
|, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 0},  |
|}, {1, a}, {a, 1}, {a, a}}                                                   |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|     2                                                                       |
|+ 1)t  + a*t )                                                               |
|     1      1                                                                |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, |
|-----------------------------------------------------------------------------|
|                                           }                                 |
|                                                                             |
|                                          }                                  |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0, 1, a + 1}, {0, 0, 0, 0, 0, 0, 1, a, 0}}                                   |
+-----------------------------------------------------------------------------+

Caveat
======

While this function may work even when a ring is given, instead of a finite
field, it is possible that the results are not the expected ones.

Ways to use cartesianCode:
==========================

  * "cartesianCode(Ring,List,List)"
  * "cartesianCode(Ring,List,Matrix)"
  * "cartesianCode(Ring,List,ZZ)"

For the programmer
==================

The object cartesianCode, is a method function with options (Macaulay2Doc).

Symbols that are used as a key for storing information of a Cartesian code

Sets -- sets of a Cartesian code
********************************

Synopsis
========

  * Usage:
        C.Sets
  * Inputs:
      * C, an instance of the type EvaluationCode,
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

This key stores a list of subsets of a field that are used for constructing a
cartesianCode.

This symbol is provided by the package CodingTheory.

+-----------------------------------------------------------------------------+
|i1 : F=GF(4);                                                                |
+-----------------------------------------------------------------------------+
|i2 : R=F[x,y];                                                               |
+-----------------------------------------------------------------------------+
|i3 : C=cartesianCode(F,{{0,1,a},{0,1,a}},{1+x+y,x*y})                        |
|                                                                             |
|o3 = EvaluationCode{cache => CacheTable{}                                    |
|                                                               9             |
|                    LinearCode => LinearCode{AmbientModule => F              |
|                                             BaseField => F                  |
|                                             cache => CacheTable{}           |
|                                             Code => image | 1   0   |       |
|                                                           | 0   0   |       |
|                                                           | 0   0   |       |
|                                                           | 1   1   |       |
|                                                           | a+1 0   |       |
|                                                           | a+1 0   |       |
|                                                           | a   a   |       |
|                                                           | a   a   |       |
|                                                           | 1   a+1 |       |
|                                             GeneratorMatrix => | 1 0 0 1 a+ |
|                                                                | 0 0 0 1 0  |
|                                             Generators => {{1, 0, 0, 1, a + |
|                                             ParityCheckMatrix => | 1 0 0 0  |
|                                                                  | 0 1 0 0  |
|                                                                  | 0 0 1 0  |
|                                                                  | 0 0 0 1  |
|                                                                  | 0 0 0 0  |
|                                                                  | 0 0 0 0  |
|                                                                  | 0 0 0 0  |
|                                             ParityCheckRows => {{1, 0, 0, 0 |
|                    Points => {{0, 0}, {1, 0}, {0, 1}, {1, 1}, {a, 0}, {0, a |
|                    PolynomialSet => {x + y + 1, x*y}                        |
|                    Sets => {{0, 1, a}, {0, 1, a}}                           |
|                                              3           2         3        |
|                    VanishingIdeal => ideal (x  + (a + 1)x  + a*x, y  + (a + |
|                                                                             |
|o3 : EvaluationCode                                                          |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1 a+1 a a 1   |                                                              |
|  0   a a a+1 |                                                              |
| 1, a + 1, a, a, 1}, {0, 0, 0, 1, 0, 0, a, a, a + 1}}                        |
|0 0 1   0 a+1 |                                                              |
|0 0 0   0 0   |                                                              |
|0 0 0   0 0   |                                                              |
|0 0 a+1 0 0   |                                                              |
|1 0 a+1 0 a   |                                                              |
|0 1 a+1 0 a   |                                                              |
|0 0 1   1 0   |                                                              |
|, 0, 0, 1, 0, a + 1}, {0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0,  |
|}, {1, a}, {a, 1}, {a, a}}                                                   |
|                                                                             |
|                                                                             |
|    2                                                                        |
| 1)y  + a*y)                                                                 |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {0, 0, 0, 1, 0, 0, a + 1, 0, 0}, {0, 0, 0, 0, 1, 0, a + 1, 0, a}, {0, 0, |
|-----------------------------------------------------------------------------|
|                                                       }                     |
|                                                                             |
|                                                      }                      |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0, 0, 0, 1, a + 1, 0, a}, {0, 0, 0, 0, 0, 0, 1, 1, 0}}                       |
+-----------------------------------------------------------------------------+
|i4 : C.Sets                                                                  |
|                                                                             |
|o4 = {{0, 1, a}, {0, 1, a}}                                                  |
|                                                                             |
|o4 : List                                                                    |
+-----------------------------------------------------------------------------+

For the programmer
==================

The object Sets, is a symbol (Macaulay2Doc).

orderCode -- computes an order code for a given weight
******************************************************

Synopsis
========

  * Usage:
        orderCode(F,P,v,d)
        orderCode(I,P,v,d)
        orderCode(I,v,d)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * P, a list (Macaulay2Doc),
      * v, a list (Macaulay2Doc),
      * I, an ideal (Macaulay2Doc),
      * d, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

Description
===========

Let F be a finite field and F$[t_1,\ldots,t_m]$ a polynomial ring with a weight
order defined by the list v of size $m$. For
P$=\{P_1,\ldots,P_n\}\subset$F$^m$, the order code of degree $d$ is the
F-vector space generated by the vectors $(f(P_1),\ldots,f(P_n))$, where $f$ is
a monomial of weight at most $d$. We describe ways to obtain an order code
below.

a list of points and the  weight vector are given
=================================================

  * Usage:
        orderCode(F,P,v,d)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * P, a list (Macaulay2Doc),
      * v, a list (Macaulay2Doc),
      * d, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

The order code $C$ of degree d over the points of P using the weight vector v.

+-----------------------------------------------------------------------------+
|i1 : F = GF(4);                                                              |
+-----------------------------------------------------------------------------+
|i2 : P = {{0, 0}, {a, a}, {a+1, a}, {1, a}, {a, a+1}, {a+1, a+1}, {1, a+1},  |
|-----------------------------------------------------------------------------|
|{0, 1}};                                                                     |
+-----------------------------------------------------------------------------+
|i3 : C = orderCode(F,P,{2,3},7);                                             |
+-----------------------------------------------------------------------------+
|i4 : peek C                                                                  |
|                                                                             |
|o4 = EvaluationCode{cache => CacheTable{}                                    |
|                    Points => {{0, 0}, {a, a}, {a + 1, a}, {1, a}, {a, a + 1 |
|                                                               8             |
|                    LinearCode => LinearCode{AmbientModule => F              |
|                                             BaseField => F                  |
|                                             cache => CacheTable{}           |
|                                             Code => image | 0   0   0 0   0 |
|                                                           | 1   a   1 a   a |
|                                                           | a+1 a   1 a+1 a |
|                                                           | a   a   1 1   a |
|                                                           | a   a+1 1 a   a |
|                                                           | 1   a+1 1 a+1 a |
|                                                           | a+1 a+1 1 1   a |
|                                                           | 0   1   0 0   1 |
|                                             GeneratorMatrix => | 0 1   a+1  |
|                                                                | 0 a   a    |
|                                                                | 0 1   1    |
|                                                                | 0 a   a+1  |
|                                                                | 0 a+1 a+1  |
|                                                                | 0 a+1 1    |
|                                                                | 1 1   1    |
|                                                                | 0 a+1 a    |
|                                             Generators => {{0, 1, a + 1, a, |
|                                             ParityCheckMatrix => | 1 1 1 1  |
|                                             ParityCheckRows => {{1, 1, 1, 1 |
|                                                2               3    2       |
|                    VanishingIdeal => ideal (t t  + t t  + t , t  + t  + t , |
|                                              0 1    0 1    0   0    1    1  |
|                                       2         3       2            2      |
|                    PolynomialSet => {t t , t , t , t , t , t t , 1, t }     |
|                                       0 1   1   0   0   1   0 1      0      |
|-----------------------------------------------------------------------------|
|                                                                             |
|}, {a + 1, a + 1}, {1, a + 1}, {0, 1}}                                       |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|   0   1 0   |                                                               |
|+1 a+1 1 a+1 |                                                               |
|+1 1   1 a   |                                                               |
|+1 a   1 1   |                                                               |
|   1   1 a+1 |                                                               |
|   a   1 a   |                                                               |
|   a+1 1 1   |                                                               |
|   0   1 0   |                                                               |
|a   a   1   a+1 0 |                                                          |
|a   a+1 a+1 a+1 1 |                                                          |
|1   1   1   1   0 |                                                          |
|1   a   a+1 1   0 |                                                          |
|a+1 a   a   a   1 |                                                          |
|a   1   a   a+1 0 |                                                          |
|1   1   1   1   1 |                                                          |
|1   a+1 a   1   0 |                                                          |
| a, 1, a + 1, 0}, {0, a, a, a, a + 1, a + 1, a + 1, 1}, {0, 1, 1, 1, 1, 1, 1,|
|1 1 1 1 |                                                                    |
|, 1, 1, 1, 1}}                                                               |
|  4                                                                          |
| t  + t )                                                                    |
|  1    1                                                                     |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {0, a, a + 1, 1, a, a + 1, 1, 0}, {0, a + 1, a + 1, a + 1, a, a, a, 1},  |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{0, a + 1, 1, a, 1, a, a + 1, 0}, {1, 1, 1, 1, 1, 1, 1, 1}, {0, a + 1, a, 1, |
|-----------------------------------------------------------------------------|
|                 }                                                           |
|                                                                             |
|                                                                             |
|                }                                                            |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|a + 1, a, 1, 0}}                                                             |
+-----------------------------------------------------------------------------+

given the ideal of the finite algebra associated to the order function and a list of points
===========================================================================================

  * Usage:
        orderCode(I,P,v,d)
  * Inputs:
      * I, an ideal (Macaulay2Doc),
      * P, a list (Macaulay2Doc),
      * v, a list (Macaulay2Doc),
      * d, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

If I is the ideal associated to the semigroup generated by v, this function
allows us to improve by knowing a basis defined through I.

+-----------------------------------------------------------------------------+
|i5 : F = GF(4);                                                              |
+-----------------------------------------------------------------------------+
|i6 : R = F[x,y];                                                             |
+-----------------------------------------------------------------------------+
|i7 : I = ideal(x^3+y^2+y)                                                    |
|                                                                             |
|            3    2                                                           |
|o7 = ideal(x  + y  + y)                                                      |
|                                                                             |
|o7 : Ideal of R                                                              |
+-----------------------------------------------------------------------------+
|i8 : P = {{0, 0}, {a, a}, {a+1, a}, {1, a}};                                 |
+-----------------------------------------------------------------------------+
|i9 : C = orderCode(I,P,{2,3},7);                                             |
+-----------------------------------------------------------------------------+
|i10 : peek C                                                                 |
|                                                                             |
|o10 = EvaluationCode{cache => CacheTable{}                                   |
|                     Points => {{0, 0}, {a, a}, {a + 1, a}, {1, a}}          |
|                                                                4            |
|                     LinearCode => LinearCode{AmbientModule => F             |
|                                              BaseField => F                 |
|                                              cache => CacheTable{}          |
|                                              Code => image | 0   0   1 0 0  |
|                                                            | a+1 a   1 1 1  |
|                                                            | a   a+1 1 1 a+ |
|                                                            | 1   1   1 1 a  |
|                                              GeneratorMatrix => | 0 a+1 a   |
|                                                                 | 0 a   a+1 |
|                                                                 | 1 1   1   |
|                                                                 | 0 1   1   |
|                                                                 | 0 1   a+1 |
|                                                                 | 0 a   a   |
|                                                                 | 0 a+1 1   |
|                                              Generators => {{0, a + 1, a, 1 |
|                                              ParityCheckMatrix => 0         |
|                                              ParityCheckRows => {}          |
|                                               2                       3     |
|                     VanishingIdeal => ideal (t  + a*t , t t  + a*t , t  + ( |
|                                               1      1   0 1      0   0     |
|                                        2          3   2                     |
|                     PolynomialSet => {t , t , 1, t , t t , t , t t }        |
|                                        0   0      0   0 1   1   0 1         |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|  0 0   |                                                                    |
|  a a+1 |                                                                    |
|1 a 1   |                                                                    |
|  a a   |                                                                    |
| 1 |                                                                         |
| 1 |                                                                         |
| 1 |                                                                         |
| 1 |                                                                         |
| a |                                                                         |
| a |                                                                         |
| a |                                                                         |
|}, {0, a, a + 1, 1}, {1, 1, 1, 1}, {0, 1, 1, 1}, {0, 1, a + 1, a}, {0, a, a, |
|                                                                             |
|                                                                             |
|                                                                             |
|a + 1)t )                                                                    |
|       1                                                                     |
|-----------------------------------------------------------------------------|
|                      }                                                      |
|                                                                             |
|                                                                             |
|                     }                                                       |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|a}, {0, a + 1, 1, a}}                                                        |
+-----------------------------------------------------------------------------+

given just an ideal and the weight vector
=========================================

  * Usage:
        orderCode(I,v,d)
  * Inputs:
      * I, an ideal (Macaulay2Doc),
      * v, a list (Macaulay2Doc),
      * d, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

The order code of degree d, using the order function defined by v and the set
of points the zeroes of I.

+-----------------------------------------------------------------------------+
|i11 : F = GF(4);                                                             |
+-----------------------------------------------------------------------------+
|i12 : R = F[x,y];                                                            |
+-----------------------------------------------------------------------------+
|i13 : I = ideal(x^3+y^2+y);                                                  |
|                                                                             |
|o13 : Ideal of R                                                             |
+-----------------------------------------------------------------------------+
|i14 : C = orderCode(I,{2,3},7);                                              |
+-----------------------------------------------------------------------------+
|i15 : peek C                                                                 |
|                                                                             |
|o15 = EvaluationCode{cache => CacheTable{}                                   |
|                     Points => {{0, 0}, {a, a}, {a + 1, a}, {1, a}, {a, a + 1|
|                                                                8            |
|                     LinearCode => LinearCode{AmbientModule => F             |
|                                              BaseField => F                 |
|                                              cache => CacheTable{}          |
|                                              Code => image | 0   0   0   0  |
|                                                            | 1   a   a+1 a+1|
|                                                            | a+1 a   1   a  |
|                                                            | a   a   a   1  |
|                                                            | a   a+1 1   a+1|
|                                                            | 1   a+1 a   a  |
|                                                            | a+1 a+1 a+1 1  |
|                                                            | 0   1   0   0  |
|                                              GeneratorMatrix => | 0 1   a+1 |
|                                                                 | 0 a   a   |
|                                                                 | 0 a+1 1   |
|                                                                 | 0 a+1 a   |
|                                                                 | 0 a   a+1 |
|                                                                 | 1 1   1   |
|                                                                 | 0 1   1   |
|                                              Generators => {{0, 1, a + 1, a,|
|                                              ParityCheckMatrix => | 1 1 1 1 |
|                                              ParityCheckRows => {{1, 1, 1, 1|
|                                                 2               3    2      |
|                     VanishingIdeal => ideal (t t  + t t  + t , t  + t  + t ,|
|                                               0 1    0 1    0   0    1    1 |
|                                        2               2          3         |
|                     PolynomialSet => {t t , t , t t , t , t , 1, t }        |
|                                        0 1   1   0 1   0   0      0         |
|-----------------------------------------------------------------------------|
|                                                                             |
|}, {a + 1, a + 1}, {1, a + 1}, {0, 1}}                                       |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 0   1 0 |                                                                   |
| a   1 1 |                                                                   |
| a+1 1 1 |                                                                   |
| 1   1 1 |                                                                   |
| a   1 1 |                                                                   |
| a+1 1 1 |                                                                   |
| 1   1 1 |                                                                   |
| 0   1 0 |                                                                   |
|a a   1   a+1 0 |                                                            |
|a a+1 a+1 a+1 1 |                                                            |
|a 1   a   a+1 0 |                                                            |
|1 a+1 a   1   0 |                                                            |
|1 a   a+1 1   0 |                                                            |
|1 1   1   1   1 |                                                            |
|1 1   1   1   0 |                                                            |
| a, 1, a + 1, 0}, {0, a, a, a, a + 1, a + 1, a + 1, 1}, {0, a + 1, 1, a, 1,  |
|1 1 1 1 |                                                                    |
|, 1, 1, 1, 1}}                                                               |
|  4                                                                          |
| t  + t )                                                                    |
|  1    1                                                                     |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|a, a + 1, 0}, {0, a + 1, a, 1, a + 1, a, 1, 0}, {0, a, a + 1, 1, a, a + 1, 1,|
|-----------------------------------------------------------------------------|
|                                                        }                    |
|                                                                             |
|                                                                             |
|                                                       }                     |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {1, 1, 1, 1, 1, 1, 1, 1}, {0, 1, 1, 1, 1, 1, 1, 0}}                      |
+-----------------------------------------------------------------------------+

Caveat
======

While this function may work even when a ring is given, instead of a finite
field, it is possible that the results are not the expected ones.

Ways to use orderCode:
======================

  * "orderCode(Ideal,List,List,ZZ)"
  * "orderCode(Ideal,List,ZZ)"
  * "orderCode(Ring,List,List,ZZ)"

For the programmer
==================

The object orderCode, is a method function with options (Macaulay2Doc).

reedSolomonCode -- constructs the Reed-Solomon code
***************************************************

Synopsis
========

  * Usage:
        reedSolomonCode(F,L,k)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
      * k, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode,

Description
===========

Given a field F, a list L of different elements of F, and an integer k, returns
the Reed-Solomon code obtained when polynomials of degree less than k are
evaluated on the elements of L.

+-----------------------------------------------------------------------------+
|i1 : C=reedSolomonCode(ZZ/31,{1,2,3},3);                                     |
+-----------------------------------------------------------------------------+
|i2 : peek C                                                                  |
|                                                                             |
|o2 = EvaluationCode{cache => CacheTable{}                                    |
|                    Points => {{1}, {2}, {3}}                                |
|                    Sets => {{1, 2, 3}}                                      |
|                                                               ZZ 3          |
|                    LinearCode => LinearCode{AmbientModule => (--)           |
|                                                               31            |
|                                                          ZZ                 |
|                                             BaseField => --                 |
|                                                          31                 |
|                                             cache => CacheTable{}           |
|                                             Code => image | 1 1 1 |         |
|                                                           | 1 2 4 |         |
|                                                           | 1 3 9 |         |
|                                             GeneratorMatrix => | 1 1 1 |    |
|                                                                | 1 2 3 |    |
|                                                                | 1 4 9 |    |
|                                             Generators => {{1, 1, 1}, {1, 2,|
|                                             ParityCheckMatrix => 0          |
|                                             ParityCheckRows => {}           |
|                                              2                              |
|                    PolynomialSet => {1, t , t }                             |
|                                          0   0                              |
|                                             3     2                         |
|                    VanishingIdeal => ideal(t  - 6t  + 11t  - 6)             |
|                                             0     0      0                  |
|-----------------------------------------------------------------------------|
|               }                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|              }                                                              |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|3}, {1, 4, 9}}                                                               |
+-----------------------------------------------------------------------------+

Ways to use reedSolomonCode:
============================

  * "reedSolomonCode(Ring,List,ZZ)"

For the programmer
==================

The object reedSolomonCode, is a method function (Macaulay2Doc).

reedMullerCode -- constructs the Reed-Muller code
*************************************************

Synopsis
========

  * Usage:
        reedMullerCode(q,m,d)
  * Inputs:
      * q, an integer (Macaulay2Doc),
      * m, an integer (Macaulay2Doc),
      * d, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode,

Description
===========

Given the integers q, m and d, returns the Reed-Muller code obtained when
polynomials in m variables of total degree at most d are evaluated on the
points of GF(q)$^\mathtt{m}$.

+-----------------------------+
|i1 : C=reedMullerCode(2,3,4);|
+-----------------------------+
|i2 : C.Sets;                 |
+-----------------------------+
|i3 : C.VanishingIdeal;       |
|                             |
|o3 : Ideal of GF 2[t ..t ]   |
|                    0   2    |
+-----------------------------+
|i4 : C.PolynomialSet;        |
+-----------------------------+
|i5 : C.LinearCode;           |
+-----------------------------+
|i6 : length C.LinearCode     |
|                             |
|o6 = 8                       |
+-----------------------------+

Ways to use reedMullerCode:
===========================

  * "reedMullerCode(ZZ,ZZ,ZZ)"

For the programmer
==================

The object reedMullerCode, is a method function (Macaulay2Doc).

toricCode -- a toric code construction
**************************************

Synopsis
========

  * Usage:
        toricCode(F,M)
  * Inputs:
      * F, a ring (Macaulay2Doc),
      * M, a matrix (Macaulay2Doc),
  * Outputs:
      * an instance of the type EvaluationCode, $C$

Description
===========

Given a finite field F and an integer matrix M, this method produces a toric
code whose lattice polytope $P$ is the convex hull of the row vectors of M. By
definition, the toric code is generated by codewords obtained by evaluating the
monomials corresponding to the lattice points of $P$ at the points of the
algebraic torus (F*)$^m$, where $m$ is the number of columns of M.

+-----------------------------------------------------------------------------+
|i1 : M=matrix{{1,4},{2,5},{10,6}};                                           |
|                                                                             |
|              3       2                                                      |
|o1 : Matrix ZZ  <-- ZZ                                                       |
+-----------------------------------------------------------------------------+
|i2 : T=toricCode(GF 4,M);                                                    |
+-----------------------------------------------------------------------------+
|i3 : T.VanishingIdeal                                                        |
|                                                                             |
|             3       3                                                       |
|o3 = ideal (t  + 1, t  + 1)                                                  |
|             1       2                                                       |
|                                                                             |
|o3 : Ideal of GF 4[t ..t ]                                                   |
|                    1   2                                                    |
+-----------------------------------------------------------------------------+
|i4 : T.ExponentsMatrix                                                       |
|                                                                             |
|o4 = | 1  4 |                                                                |
|     | 2  5 |                                                                |
|     | 3  5 |                                                                |
|     | 4  5 |                                                                |
|     | 5  5 |                                                                |
|     | 10 6 |                                                                |
|                                                                             |
|              6       2                                                      |
|o4 : Matrix ZZ  <-- ZZ                                                       |
+-----------------------------------------------------------------------------+
|i5 : T.LinearCode                                                            |
|                                                                             |
|                                       9                                     |
|o5 = LinearCode{AmbientModule => (GF 4)                                      |
|                BaseField => GF 4                                            |
|                cache => CacheTable{}                                        |
|                Code => image | a   a+1 1   a   a+1 a   |                    |
|                              | a+1 a   a+1 1   a   a   |                    |
|                              | a   a+1 a+1 a+1 a+1 1   |                    |
|                              | 1   1   1   1   1   1   |                    |
|                              | a+1 a   1   a+1 a   a+1 |                    |
|                              | 1   1   a+1 a   1   a+1 |                    |
|                              | 1   1   a   a+1 1   a   |                    |
|                              | a+1 a   a   a   a   1   |                    |
|                              | a   a+1 a   1   a+1 a+1 |                    |
|                GeneratorMatrix => | a   a+1 a   1 a+1 1   1   a+1 a   |     |
|                                   | a+1 a   a+1 1 a   1   1   a   a+1 |     |
|                                   | 1   a+1 a+1 1 1   a+1 a   a   a   |     |
|                                   | a   1   a+1 1 a+1 a   a+1 a   1   |     |
|                                   | a+1 a   a+1 1 a   1   1   a   a+1 |     |
|                                   | a   a   1   1 a+1 a+1 a   1   a+1 |     |
|                Generators => {{a, a + 1, a, 1, a + 1, 1, 1, a + 1, a}, {a + |
|                ParityCheckMatrix => | 1 0 0 0 a+1 0   a+1 0   a   |         |
|                                     | 0 1 0 0 0   a+1 a   0   1   |         |
|                                     | 0 0 1 0 0   a   0   a   a+1 |         |
|                                     | 0 0 0 1 a   0   0   a+1 1   |         |
|                ParityCheckRows => {{1, 0, 0, 0, a + 1, 0, a + 1, 0, a}, {0, |
|                                                                             |
|o5 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, a, a + 1, 1, a, 1, 1, a, a + 1}, {1, a + 1, a + 1, 1, 1, a                |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, 0, 0, 0, a + 1, a, 0, 1}, {0, 0, 1, 0, 0, a, 0, a, a + 1},                |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|+ 1, a, a, a}, {a, 1, a + 1, 1, a + 1, a, a + 1, a, 1}, {a + 1, a, a + 1, 1, |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{0, 0, 0, 1, a, 0, 0, a + 1, 1}}                                             |
|-----------------------------------------------------------------------------|
|                                                            }                |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|a, 1, 1, a, a + 1}, {a, a, 1, 1, a + 1, a + 1, a, 1, a + 1}}                 |
+-----------------------------------------------------------------------------+
|i6 : length T.LinearCode                                                     |
|                                                                             |
|o6 = 9                                                                       |
+-----------------------------------------------------------------------------+
|i7 : dim T.LinearCode                                                        |
|                                                                             |
|o7 = 5                                                                       |
+-----------------------------------------------------------------------------+

Ways to use toricCode:
======================

  * "toricCode(Ring,Matrix)"

For the programmer
==================

The object toricCode, is a method function with options (Macaulay2Doc).

Symbols that are used as a key for storing information of a toric code

ExponentsMatrix -- specifies the matrix of exponents
****************************************************

Synopsis
========

  * Usage:
        C.Code
  * Inputs:
      * C, an instance of the type EvaluationCode,
  * Outputs:
      * a matrix (Macaulay2Doc),

Description
===========

This symbol is used as a key for storing the matrix of exponents, which is used
for the function toricCode.

This symbol is provided by the package CodingTheory.

+----------------------------------+
|i1 : M=matrix{{1,4},{2,5},{10,6}};|
|                                  |
|              3       2           |
|o1 : Matrix ZZ  <-- ZZ            |
+----------------------------------+
|i2 : T=toricCode(GF 4,M);         |
+----------------------------------+
|i3 : T.ExponentsMatrix            |
|                                  |
|o3 = | 1  4 |                     |
|     | 2  5 |                     |
|     | 3  5 |                     |
|     | 4  5 |                     |
|     | 5  5 |                     |
|     | 10 6 |                     |
|                                  |
|              6       2           |
|o3 : Matrix ZZ  <-- ZZ            |
+----------------------------------+

For the programmer
==================

The object ExponentsMatrix, is a symbol (Macaulay2Doc).

footPrint -- generalized footprint function of an ideal
*******************************************************

Synopsis
========

  * Usage:
        footPrint(d,r,I)
  * Inputs:
      * I, an ideal (Macaulay2Doc),
      * d, an integer (Macaulay2Doc),
      * r, an integer (Macaulay2Doc),
  * Outputs:
      * an integer (Macaulay2Doc),

Description
===========

Returns the value of the generalized footprint function of the ideal I on the
parameters d and r. Given an ideal I, a monomial is called standard of I if it
is not a leading monomial of any polynomial of I. The parameters d and r are
used as follows. The function computes the degree of the ideal generated by
sets of r standard monomials of degree at most d. The footprint function is a
lower bound of the generalized minimum function genMinDisIdeal.
More information about the footprint function can be found in
Definition 1.3 at https://arxiv.org/pdf/1812.06529v1.pdf

+-------------------------+
|i1 : K=QQ;               |
+-------------------------+
|i2 : R=K[t1,t2,t3];      |
+-------------------------+
|i3 : I=ideal(t1^3,t2*t3);|
|                         |
|o3 : Ideal of R          |
+-------------------------+
|i4 : footPrint(2,3,I)    |
|                         |
|o4 = 4                   |
+-------------------------+

Ways to use footPrint:
======================

  * "footPrint(ZZ,ZZ,Ideal)"

For the programmer
==================

The object footPrint, is a method function (Macaulay2Doc).

genMinDisIdeal -- generalized minimum distance function of an ideal
*******************************************************************

Synopsis
========

  * Usage:
        genMinDisIdeal(d,r,I)
  * Inputs:
      * d, an integer (Macaulay2Doc),
      * r, an integer (Macaulay2Doc),
      * I, an ideal (Macaulay2Doc),
  * Outputs:
      * an integer (Macaulay2Doc),

Description
===========

Returns the value of the generalized minimum distance function (GMDF) of the
ideal I on the parameters d and r. The GMDF generalizes the Hamming weights of
Reed-Muller-type codes. The integers d and r indique that the function is
computing the degree of the ideal generated by r-tuples of polynomials of
degree at most d that are linearly independent modulo the ideal I. More
information about the GMDF can be found in Definition 1.1 at
https://arxiv.org/pdf/1812.06529v1.pdf.

+--------------------------------------+
|i1 : K=ZZ/3;                          |
+--------------------------------------+
|i2 : R=K[t1,t2,t3,t4,t5,t6];          |
+--------------------------------------+
|i3 : I=ideal(t1*t6-t3*t4,t2*t6-t3*t5);|
|                                      |
|o3 : Ideal of R                       |
+--------------------------------------+
|i4 : genMinDisIdeal(1,1,I)            |
|                                      |
|o4 = 3                                |
+--------------------------------------+

Ways to use genMinDisIdeal:
===========================

  * "genMinDisIdeal(ZZ,ZZ,Ideal)"

For the programmer
==================

The object genMinDisIdeal, is a method function (Macaulay2Doc).

hyp -- hyp function of an ideal
*******************************

Synopsis
========

  * Usage:
        hyp(d,r,I)
  * Inputs:
      * d, an integer (Macaulay2Doc),
      * r, an integer (Macaulay2Doc),
      * I, an ideal (Macaulay2Doc),
  * Outputs:
      * an integer (Macaulay2Doc),

Description
===========

Returns the value of the hyp function (HypF) of the ideal I on the parameters d
and r. The HypF computes the maximum degree of the ideals generated by r-tuples
of polynomials of degree at most d that are linearly independent modulo the
ideal I. Finding upper bounds for this functions is equivalent to finding lower
bounds for the generalized minimum distance function genMinDisIdeal.
More information about the Hyp can be found in Definition 1.2
at https://arxiv.org/pdf/1812.06529v1.pdf.

+--------------------------------------+
|i1 : K=ZZ/3;                          |
+--------------------------------------+
|i2 : R=K[t1,t2,t3,t4,t5,t6];          |
+--------------------------------------+
|i3 : I=ideal(t1*t6-t3*t4,t2*t6-t3*t5);|
|                                      |
|o3 : Ideal of R                       |
+--------------------------------------+
|i4 : hyp(1,1,I)                       |
|                                      |
|o4 = 1                                |
+--------------------------------------+

Ways to use hyp:
================

  * "hyp(ZZ,ZZ,Ideal)"

For the programmer
==================

The object hyp, is a method function (Macaulay2Doc).

vasconcelosDegree -- Vasconcelos function of an ideal
*****************************************************

Synopsis
========

  * Usage:
        vasconcelosDegree(d,r,I)
  * Inputs:
      * d, an integer (Macaulay2Doc),
      * r, an integer (Macaulay2Doc),
      * I, an ideal (Macaulay2Doc),
  * Outputs:
      * an integer (Macaulay2Doc),

Description
===========

Returns the value of the Vasconcelos function of the ideal I on the parameters
d and r. In the case of a graded unmixed radical ideal I, the Vasconcelos
function is equal to the generalized minimum distance function
genMinDisIdeal. The Vasconcelos function computes the minimum
value of the degree of I minus the degree of the ideal generated by r-tuples of
polynomials of degree at most d that are linearly independent modulo the ideal
I. More information about the Vasconcelos function can be found in Definition
3.4 at https://arxiv.org/pdf/1812.06529v1.pdf.

+-----------------------------+
|i1 : K=QQ;                   |
+-----------------------------+
|i2 : R=K[t1,t2,t3];          |
+-----------------------------+
|i3 : I=ideal(t1^3,t2*t3);    |
|                             |
|o3 : Ideal of R              |
+-----------------------------+
|i4 : vasconcelosDegree(1,1,I)|
|                             |
|o4 = infinity                |
|                             |
|o4 : InfiniteNumber          |
+-----------------------------+

Ways to use vasconcelosDegree:
==============================

  * "vasconcelosDegree(ZZ,ZZ,Ideal)"

For the programmer
==================

The object vasconcelosDegree, is a method function (Macaulay2Doc).

vNumber -- the v-number of a graded ideal
*****************************************

Synopsis
========

  * Usage:
        vNumber(I)
  * Inputs:
      * I, an ideal (Macaulay2Doc),
  * Outputs:
      * an integer (Macaulay2Doc),

Description
===========

Returns the v-number of a graded ideal I. This invariant is used to express the
regularity index of the generalized minimum distance function of the ideal I on
the parameter $r=1$ See genMinDisIdeal. Moreover, the
v-number has other combinatorial implications. More information about the
v-number can be found in Definition 4.1 at
https://arxiv.org/pdf/1812.06529v1.pdf.

+--------------------------------------------------------------+
|i1 : K=ZZ/3;                                                  |
+--------------------------------------------------------------+
|i2 : R=K[t3,t2,t1,MonomialOrder=>Lex];                        |
+--------------------------------------------------------------+
|i3 : I=ideal(t1*t2^2-t1^2*t2,t1*t3^3-t1^3*t3,t2*t3^3-t2^3*t3);|
|                                                              |
|o3 : Ideal of R                                               |
+--------------------------------------------------------------+
|i4 : vNumber(I)                                               |
|                                                              |
|o4 = 3                                                        |
+--------------------------------------------------------------+

Ways to use vNumber:
====================

  * "vNumber(Ideal)"

For the programmer
==================

The object vNumber, is a method function (Macaulay2Doc).

PolynomialSet -- a set of polynomials for an evaluation code
************************************************************

Synopsis
========

  * Usage:
        C.PolynomialSet
  * Inputs:
      * C, an instance of the type EvaluationCode,
  * Outputs:
      * a set (Macaulay2Doc),

Description
===========

This key stores a polynomial set used to construct an EvaluationCode.

This symbol is provided by the package CodingTheory.

+---------------------------------+
|i1 : F=GF(4,Variable=>a);        |
+---------------------------------+
|i2 : R=F[x,y];                   |
+---------------------------------+
|i3 : P={{0,0},{1,0},{0,1},{a,a}};|
+---------------------------------+
|i4 : S={x+y,x^2+y^2,a+x*y^2};    |
+---------------------------------+
|i5 : C=evaluationCode(F,P,S);    |
+---------------------------------+
|i6 : C.PolynomialSet             |
|                                 |
|              2    2     2       |
|o6 = {x + y, x  + y , x*y  + a}  |
|                                 |
|o6 : List                        |
+---------------------------------+

For the programmer
==================

The object PolynomialSet, is a symbol (Macaulay2Doc).

VanishingIdeal -- vanishing ideal of an evaluation code
*******************************************************

Synopsis
========

  * Usage:
        C.VanishingIdeal
  * Inputs:
      * C, an instance of the type EvaluationCode,
  * Outputs:
      * an ideal (Macaulay2Doc),

Description
===========

This key stores the vanishing ideal of the set of points that are used for
constructing an EvaluationCode.

This symbol is provided by the package CodingTheory.

+--------------------------------------------------------+
|i1 : F=GF(4);                                           |
+--------------------------------------------------------+
|i2 : R=F[x,y];                                          |
+--------------------------------------------------------+
|i3 : P={{0,0},{1,0},{0,1},{a,a}};                       |
+--------------------------------------------------------+
|i4 : S={x+y,x^2+y^2, a+x*y^2};                          |
+--------------------------------------------------------+
|i5 : C=evaluationCode(F,P,S);                           |
+--------------------------------------------------------+
|i6 : C.VanishingIdeal                                   |
|                                                        |
|                          2              2    2         |
|o6 = ideal (x*y + (a + 1)y  + (a + 1)y, x  + y  + x + y)|
|                                                        |
|o6 : Ideal of R                                         |
+--------------------------------------------------------+

For the programmer
==================

The object VanishingIdeal, is a symbol (Macaulay2Doc).

LinearCode -- class of linear codes
***********************************

Description
===========

A linear code is the image of some mapping between vector spaces, where each
vector space is taken to be over the same finite field. A codeword is an
element of the image. A linear code in Macaulay2 is implemented as a hash
table. The values of the hash table correspond to common representations of the
code, as well as information about its structure. The values include the base
field of the modules, a set of generators for the code, and more. To construct
a linear code, see linearCode.

+-----------------------------------------------------------------------------+
|i1 : F1=GF(2)                                                                |
|                                                                             |
|o1 = F1                                                                      |
|                                                                             |
|o1 : GaloisField                                                             |
+-----------------------------------------------------------------------------+
|i2 : G1={{1,1,0,0,0,0},{0,0,1,1,0,0},{0,0,0,0,1,1}}                          |
|                                                                             |
|o2 = {{1, 1, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 1, 1}}            |
|                                                                             |
|o2 : List                                                                    |
+-----------------------------------------------------------------------------+
|i3 : C1=linearCode(F1,G1)                                                    |
|                                                                             |
|                                   6                                         |
|o3 = LinearCode{AmbientModule => F1                                          |
|                BaseField => F1                                              |
|                cache => CacheTable{}                                        |
|                Code => image | 1 0 0 |                                      |
|                              | 1 0 0 |                                      |
|                              | 0 1 0 |                                      |
|                              | 0 1 0 |                                      |
|                              | 0 0 1 |                                      |
|                              | 0 0 1 |                                      |
|                GeneratorMatrix => | 1 1 0 0 0 0 |                           |
|                                   | 0 0 1 1 0 0 |                           |
|                                   | 0 0 0 0 1 1 |                           |
|                Generators => {{1, 1, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0}, {0, 0,|
|                ParityCheckMatrix => | 1 1 0 0 0 0 |                         |
|                                     | 0 0 1 1 0 0 |                         |
|                                     | 0 0 0 0 1 1 |                         |
|                ParityCheckRows => {{1, 1, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0}, {|
|                                                                             |
|o3 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                  }                                                          |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 0, 0, 1, 1}}                                                                |
|                                                                             |
|                                                                             |
|                                                                             |
|0, 0, 0, 0, 1, 1}}                                                           |
+-----------------------------------------------------------------------------+
|i4 : C1.Code                                                                 |
|                                                                             |
|o4 = image | 1 0 0 |                                                         |
|           | 1 0 0 |                                                         |
|           | 0 1 0 |                                                         |
|           | 0 1 0 |                                                         |
|           | 0 0 1 |                                                         |
|           | 0 0 1 |                                                         |
|                                                                             |
|                               6                                             |
|o4 : F1-module, submodule of F1                                              |
+-----------------------------------------------------------------------------+

For the mapping defined above, we call the codomain of the mapping the ambient
module. The length of a code is defined to be the rank of this module.

+-----------------------------------------------------------------------------+
|i5 : F2=GF(3)                                                                |
|                                                                             |
|o5 = F2                                                                      |
|                                                                             |
|o5 : GaloisField                                                             |
+-----------------------------------------------------------------------------+
|i6 : G2={{1,0,0,0,0,1,1,1},{0,1,0,0,1,0,1,1},{0,0,1,0,1,1,0,1},{0,0,0,1,1,1,1|
|                                                                             |
|o6 = {{1, 0, 0, 0, 0, 1, 1, 1}, {0, 1, 0, 0, 1, 0, 1, 1}, {0, 0, 1, 0, 1, 1, |
|     ------------------------------------------------------------------------|
|     0, 1}, {0, 0, 0, 1, 1, 1, 1, 0}}                                        |
|                                                                             |
|o6 : List                                                                    |
|-----------------------------------------------------------------------------|
|,0}}                                                                         |
+-----------------------------------------------------------------------------+
|i7 : C2=linearCode(F2,G2)                                                    |
|                                                                             |
|                                   8                                         |
|o7 = LinearCode{AmbientModule => F2                                          |
|                BaseField => F2                                              |
|                cache => CacheTable{}                                        |
|                Code => image | 1 0 0 0 |                                    |
|                              | 0 1 0 0 |                                    |
|                              | 0 0 1 0 |                                    |
|                              | 0 0 0 1 |                                    |
|                              | 0 1 1 1 |                                    |
|                              | 1 0 1 1 |                                    |
|                              | 1 1 0 1 |                                    |
|                              | 1 1 1 0 |                                    |
|                GeneratorMatrix => | 1 0 0 0 0 1 1 1 |                       |
|                                   | 0 1 0 0 1 0 1 1 |                       |
|                                   | 0 0 1 0 1 1 0 1 |                       |
|                                   | 0 0 0 1 1 1 1 0 |                       |
|                Generators => {{1, 0, 0, 0, 0, 1, 1, 1}, {0,                 |
|                ParityCheckMatrix => | 1 0 0 -1 0 -1 -1 1  |                 |
|                                     | 0 1 0 -1 0 1  0  -1 |                 |
|                                     | 0 0 1 -1 0 0  1  -1 |                 |
|                                     | 0 0 0 0  1 1  1  1  |                 |
|                ParityCheckRows => {{1, 0, 0, -1, 0, -1, -1,                 |
|                                                                             |
|o7 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, 0, 0, 1, 0, 1, 1}, {0, 0, 1, 0, 1, 1, 0, 1}, {0, 0, 0, 1, 1, 1, 1, 0}}    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1}, {0, 1, 0, -1, 0, 1, 0, -1}, {0, 0, 1, -1, 0, 0, 1, -1}, {0, 0, 0, 0, 1,  |
|-----------------------------------------------------------------------------|
|         }                                                                   |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, 1, 1}}                                                                    |
+-----------------------------------------------------------------------------+
|i8 : AM=C2.AmbientModule                                                     |
|                                                                             |
|       8                                                                     |
|o8 = F2                                                                      |
|                                                                             |
|o8 : F2-module, free                                                         |
+-----------------------------------------------------------------------------+
|i9 : rank(AM)==length(C2)                                                    |
|                                                                             |
|o9 = true                                                                    |
+-----------------------------------------------------------------------------+

Since a linear code $C$ is a vector subspace over some finite field, we may
represent it using a Generator Matrix, i.e., a matrix whose rows form a basis
for $C$. The dimension of a code is the rank of the generator matrix.

+---------------------------------------+
|i10 : dim(C2)==rank(C2.GeneratorMatrix)|
|                                       |
|o10 = true                             |
+---------------------------------------+

A linear code in Macaulay2 also includes a parity check matrix $H$, which
generates the vector space orthogonal to $C$. Let $c$ be a code word in $C$ and
$h$ a vector in the space generated by the rows of $H$. Then the dot product
between $c$ and $h$ is zero.

+-------------------------------------------------------------+
|i11 : c=matrix{G2_0}                                         |
|                                                             |
|o11 = | 1 0 0 0 0 1 1 1 |                                    |
|                                                             |
|               1       8                                     |
|o11 : Matrix ZZ  <-- ZZ                                      |
+-------------------------------------------------------------+
|i12 : h=transpose matrix({(entries(C2.ParityCheckMatrix))_0})|
|                                                             |
|o12 = | 1  |                                                 |
|      | 0  |                                                 |
|      | 0  |                                                 |
|      | -1 |                                                 |
|      | 0  |                                                 |
|      | -1 |                                                 |
|      | -1 |                                                 |
|      | 1  |                                                 |
|                                                             |
|               8       1                                     |
|o12 : Matrix F2  <-- F2                                      |
+-------------------------------------------------------------+
|i13 : c*h                                                    |
|                                                             |
|o13 = 0                                                      |
|                                                             |
|               1       1                                     |
|o13 : Matrix F2  <-- F2                                      |
+-------------------------------------------------------------+

Caveat
======

While some functions may work even when a ring is given, instead of a finite
field, it is possible that the results are not the expected ones.

Functions and methods returning an object of class LinearCode:
==============================================================

  * cyclicCode -- cyclic codes
  * "cyclicCode(GaloisField,RingElement,ZZ)" -- see cyclicCode,
    -- cyclic codes
  * "cyclicCode(GaloisField,ZZ,ZZ)" -- see cyclicCode, --
    cyclic codes
  * "dualCode(LinearCode)" -- see dualCode, -- dual of a code
  * genericCode -- ambient space of a code
  * "genericCode(LinearCode)" -- see genericCode, -- ambient
    space of a code
  * hammingCode -- generates a Hamming code
  * "hammingCode(ZZ,ZZ)" -- see hammingCode, -- generates a
    Hamming code
  * "linearCode(GaloisField,List)" -- see linearCode, --
    functions to construct linear codes over Galois fields
  * "linearCode(GaloisField,ZZ,List)" -- see linearCode, --
    functions to construct linear codes over Galois fields
  * "linearCode(Matrix)" -- see linearCode, -- functions to
    construct linear codes over Galois fields
  * "linearCode(Module)" -- see linearCode, -- functions to
    construct linear codes over Galois fields
  * "linearCode(Module,List)" -- see linearCode, -- functions
    to construct linear codes over Galois fields
  * "linearCode(ZZ,ZZ,ZZ,List)" -- see linearCode, --
    functions to construct linear codes over Galois fields
  * locallyRecoverableCode -- constructs a
    locally recoverable code (LRC)
  * "locallyRecoverableCode(List,List,RingElement)" -- see
    locallyRecoverableCode, -- constructs a locally
    recoverable code (LRC)
  * quasiCyclicCode -- constructs a quasi-cyclic code
  * "quasiCyclicCode(GaloisField,List)" -- see quasiCyclicCode,
    -- constructs a quasi-cyclic code
  * "quasiCyclicCode(List)" -- see quasiCyclicCode, --
    constructs a quasi-cyclic code
  * randomCode -- constructs a random linear code over a
    finite field
  * "randomCode(GaloisField,ZZ,ZZ)" -- see randomCode, --
    constructs a random linear code over a finite field
  * "randomCode(QuotientRing,ZZ,ZZ)" -- see randomCode, --
    constructs a random linear code over a finite field
  * "repetitionCode(GaloisField,ZZ)" -- see repetitionCode,
    -- repetition code
  * shorten -- shortens a code
  * "shorten(LinearCode,List)" -- see shorten, -- shortens a
    code
  * "shorten(LinearCode,ZZ)" -- see shorten, -- shortens a code
  * "universeCode(GaloisField,ZZ)" -- see universeCode, --
    linear code $\mathtt{F}^\mathtt{n}$
  * "zeroCode(GaloisField,ZZ)" -- see zeroCode, -- zero code
  * "zeroSumCode(GaloisField,ZZ)" -- see zeroSumCode, --
    linear code in which the entries of each codeword add up zero

Methods that use an object of class LinearCode:
===============================================

  * "alphabet(LinearCode)" -- see alphabet, -- elements of the
    base ring of a code
  * "ambientSpace(LinearCode)" -- see ambientSpace, --
    recovers the ambient module of a code
  * "chooseStrat(LinearCode)" -- see chooseStrat, --
    Estimate the optimal strategy to compute the minimum weight of a linear
    code.
  * "codewords(LinearCode)" -- see codewords, -- codewords of
    the code
  * dim(LinearCode) -- dimension of a linear code
  * "field(LinearCode)" -- see field, -- the field of a code
  * "informationRate(LinearCode)" -- see informationRate,
    -- information rate of a code
  * length(LinearCode) -- returns the length of
    a linear code
  * LinearCode == LinearCode -- determines if
    two linear codes are equal
  * "messages(LinearCode)" -- see messages, -- set of messages
    to be encoded by a code
  * "minimumWeight(LinearCode)" -- see minimumWeight, --
    computes the minimum weight of a linear code
  * ring(LinearCode) -- the ring of a code
  * size(LinearCode) -- gives the number of
    codewords in a linear code
  * "syndromeDecode(LinearCode,Matrix,ZZ)" -- see syndromeDecode,
    -- syndrome decoding on a code
  * toString(LinearCode) -- string with the
    vectors of a generator matrix of a code
  * "vectorSpace(LinearCode)" -- see vectorSpace, -- vector
    space of a code

For the programmer
==================

The object LinearCode, is a type (Macaulay2Doc),
with ancestor classes HashTable (Macaulay2Doc), < Thing (Macaulay2Doc).

Related functions and symbols:

ambientSpace -- recovers the ambient module of a code
*****************************************************

Synopsis
========

  * Usage:
        ambientSpace C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a module (Macaulay2Doc),

Description
===========

Given a code C of length $n$ over the field $F$, this function extracts the
ambient module $F^n$, which is the value stored under the key AmbientModule of
the hash table C.LinearCode.

+-------------------------------------------+
|i1 : F=GF(4,Variable=>a);                  |
+-------------------------------------------+
|i2 : C=linearCode(matrix{{1,a,0},{0,1,a}});|
+-------------------------------------------+
|i3 : ambientSpace C                        |
|                                           |
|      3                                    |
|o3 = F                                     |
|                                           |
|o3 : F-module, free                        |
+-------------------------------------------+

Ways to use ambientSpace:
=========================

  * "ambientSpace(LinearCode)"

For the programmer
==================

The object ambientSpace, is a method function (Macaulay2Doc).

Related functions and symbols:

alphabet -- elements of the base ring of a code
***********************************************

Synopsis
========

  * Usage:
        alphabet(C)
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

Given a linear code C, the function returns the list of all elements of the
ring $R$, where $R$ is the ring containing the entries of the generator matrix
of C.

+-------------------------------------------+
|i1 : F=GF(4, Variable=>a);                 |
+-------------------------------------------+
|i2 : C=linearCode(matrix{{1,a,0},{0,1,a}});|
+-------------------------------------------+
|i3 : alphabet(C)                           |
|                                           |
|o3 = {0, a, a + 1, 1}                      |
|                                           |
|o3 : List                                  |
+-------------------------------------------+

Ways to use alphabet:
=====================

  * "alphabet(LinearCode)"

For the programmer
==================

The object alphabet, is a method function (Macaulay2Doc).

AmbientModule -- the ambient module of a code
*********************************************

Synopsis
========

  * Usage:
        C.AmbientModule
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a module (Macaulay2Doc),

Description
===========

Given a linear code C of length $n$ over a Galois Field $F$, this symbol is
used as a key for storing the free module $F^n$, which is referred to as the
ambient module of C.

This symbol is provided by the package CodingTheory.

+-----------------------------------------------------------------------------+
|i1 : C = linearCode(GF(4,Variable => a), {{1,0,a,0,0},{0,a,a+1,1,0},{1,1,1,a,|
|                                                                             |
|                                       5                                     |
|o1 = LinearCode{AmbientModule => (GF 4)                                      |
|                BaseField => GF 4                                            |
|                cache => CacheTable{}                                        |
|                Code => image | 1 0   1 |                                    |
|                              | 0 a   1 |                                    |
|                              | a a+1 1 |                                    |
|                              | 0 1   a |                                    |
|                              | 0 0   0 |                                    |
|                GeneratorMatrix => | 1 0 a   0 0 |                           |
|                                   | 0 a a+1 1 0 |                           |
|                                   | 1 1 1   a 0 |                           |
|                Generators => {{1, 0, a, 0, 0}, {0, a, a + 1, 1, 0}, {1, 1, 1|
|                ParityCheckMatrix => | 1 a+1 a+1 a+1 0 |                     |
|                                     | 0 0   0   0   1 |                     |
|                ParityCheckRows => {{1, a + 1, a + 1, a + 1, 0}, {0, 0, 0, 0,|
|                                                                             |
|o1 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|0}})                                                                         |
|                                                                             |
|                                                                             |
|        }                                                                    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|, a, 0}}                                                                     |
|                                                                             |
|                                                                             |
| 1}}                                                                         |
+-----------------------------------------------------------------------------+
|i2 : C.AmbientModule                                                         |
|                                                                             |
|           5                                                                 |
|o2 = (GF 4)                                                                  |
|                                                                             |
|o2 : GF 4-module, free                                                       |
+-----------------------------------------------------------------------------+

For the programmer
==================

The object AmbientModule, is a symbol (Macaulay2Doc).

BaseField -- the field of a code
********************************

Synopsis
========

  * Usage:
        C.BaseField
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a Galois field (Macaulay2Doc),

Description
===========

Given a linear code C over a Galois field $F$, this symbol is used as a key for
storing the Galois field $F$.

This symbol is provided by the package CodingTheory.

+-----------------------------------------------------------------------------+
|i1 : C = linearCode(GF(8,Variable => b), {{1,0,b,0,0},{0,b,b+1,1,0},{1,1,1,b,|
|                                                                             |
|                                       5                                     |
|o1 = LinearCode{AmbientModule => (GF 8)                                      |
|                BaseField => GF 8                                            |
|                cache => CacheTable{}                                        |
|                Code => image | 1 0   1 |                                    |
|                              | 0 b   1 |                                    |
|                              | b b+1 1 |                                    |
|                              | 0 1   b |                                    |
|                              | 0 0   0 |                                    |
|                GeneratorMatrix => | 1 0 b   0 0 |                           |
|                                   | 0 b b+1 1 0 |                           |
|                                   | 1 1 1   b 0 |                           |
|                Generators => {{1, 0, b, 0, 0}, {0, b, b + 1, 1, 0}, {1, 1, 1|
|                ParityCheckMatrix => | 1 b2+1 b2+1 b2+1 0 |                  |
|                                     | 0 0    0    0    1 |                  |
|                                         2       2       2                   |
|                ParityCheckRows => {{1, b  + 1, b  + 1, b  + 1, 0}, {0, 0, 0,|
|                                                                             |
|o1 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|0}})                                                                         |
|                                                                             |
|                                                                             |
|        }                                                                    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|, b, 0}}                                                                     |
|                                                                             |
|                                                                             |
|                                                                             |
| 0, 1}}                                                                      |
+-----------------------------------------------------------------------------+
|i2 : C.BaseField                                                             |
|                                                                             |
|o2 = GF 8                                                                    |
|                                                                             |
|o2 : GaloisField                                                             |
+-----------------------------------------------------------------------------+

For the programmer
==================

The object BaseField, is a symbol (Macaulay2Doc).

field -- the field of a code
****************************

Synopsis
========

  * Usage:
        field (C)
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a ring (Macaulay2Doc),

Description
===========

Given a code C, returns the field (or ring) that contains the entries of the
generator matrix of C.

+-------------------------------------------+
|i1 : F=GF(4,Variable=>a);                  |
+-------------------------------------------+
|i2 : C=linearCode(matrix{{1,a,0},{0,1,a}});|
+-------------------------------------------+
|i3 : field C                               |
|                                           |
|o3 = F                                     |
|                                           |
|o3 : GaloisField                           |
+-------------------------------------------+

Ways to use field:
==================

  * "field(LinearCode)"

For the programmer
==================

The object field, is a method function (Macaulay2Doc).

vectorSpace -- vector space of a code
*************************************

Synopsis
========

  * Usage:
        vectorSpace C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a module (Macaulay2Doc), $V$

Description
===========

Given a linear code C, this function returns $V$, the vector space spanned by
the rows of a generator matrix of C.

+--------------------------------------+
|i1 : H = hammingCode(2,3);            |
+--------------------------------------+
|i2 : vectorSpace H                    |
|                                      |
|o2 = image | 1 0 1 1 |                |
|           | 1 1 0 1 |                |
|           | 1 1 1 0 |                |
|           | 1 0 0 0 |                |
|           | 0 1 0 0 |                |
|           | 0 0 1 0 |                |
|           | 0 0 0 1 |                |
|                                      |
|                                     7|
|o2 : GF 2-module, submodule of (GF 2) |
+--------------------------------------+

The next is an example for the class of EvaluationCode.

+---------------------------------------+
|i3 : RM = reedMullerCode(2,4,1);       |
+---------------------------------------+
|i4 : vectorSpace(RM.LinearCode)        |
|                                       |
|o4 = image | 1 0 0 1 1 |               |
|           | 1 0 0 1 0 |               |
|           | 1 1 1 0 1 |               |
|           | 1 1 1 0 0 |               |
|           | 1 0 0 0 0 |               |
|           | 1 0 0 0 1 |               |
|           | 1 0 1 0 0 |               |
|           | 1 0 1 1 1 |               |
|           | 1 0 1 1 0 |               |
|           | 1 0 1 0 1 |               |
|           | 1 1 0 0 1 |               |
|           | 1 1 0 1 0 |               |
|           | 1 1 0 1 1 |               |
|           | 1 1 0 0 0 |               |
|           | 1 1 1 1 0 |               |
|           | 1 1 1 1 1 |               |
|                                       |
|                                     16|
|o4 : GF 2-module, submodule of (GF 2)  |
+---------------------------------------+

Ways to use vectorSpace:
========================

  * "vectorSpace(LinearCode)"

For the programmer
==================

The object vectorSpace, is a method function (Macaulay2Doc).

bitflipDecode -- an experimental implementation of a message passing decoder
****************************************************************************

Synopsis
========

  * Usage:
        bitflipDecoder(H,v,maxI)
  * Inputs:
      * H, a matrix (Macaulay2Doc),
      * v, a vector (Macaulay2Doc),
      * maxI, an integer (Macaulay2Doc),
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

Attempts to decode the vector v relative to the parity check matrix H using a
message passing decoding algorithm. The matrix H and the vector v must have
entries in GF(2). Returns the empty list if maxI is exceeded.

At each iteration, this function flips all the bits of v that fail the maximum
number of parity check equations from H. This is experimental because it has
not been fully tested. The output is only guaranteed to be a codeword of the
code defined by H.

+-----------------------------------------------------------------------------+
|i1 : R=GF(2);                                                                |
+-----------------------------------------------------------------------------+
|i2 : H := matrix(R, {{1,1,0,0,0,0,0},{0,1,1,0,0,0,0},{0,1,1,1,1,0,0},{0,0,0,1|
|                                                                             |
|             6      7                                                        |
|o2 : Matrix R  <-- R                                                         |
|-----------------------------------------------------------------------------|
|,1,0,0},{0,0,0,0,1,1,0},{0,0,0,0,1,0,1}});                                   |
+-----------------------------------------------------------------------------+
|i3 : v := vector transpose matrix(R, {{1,0,0,1,0,1,1}});                     |
|                                                                             |
|      7                                                                      |
|o3 : R                                                                       |
+-----------------------------------------------------------------------------+
|i4 : bitflipDecode(H,v,100)                                                  |
|                                                                             |
|o4 = {0, 0, 0, 1, 1, 1, 1}                                                   |
|                                                                             |
|o4 : List                                                                    |
+-----------------------------------------------------------------------------+

Ways to use bitflipDecode:
==========================

  * "bitflipDecode(Matrix,Vector,ZZ)"

For the programmer
==================

The object bitflipDecode, is a method function (Macaulay2Doc).

Code -- a code as image
***********************

Synopsis
========

  * Usage:
        C.Code
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a module (Macaulay2Doc),

Description
===========

Given a linear code C, this symbol is used as a key for storing C as the image
of some mapping between finitely generated modules, where each module is over
the same Galois field.

This symbol is provided by the package CodingTheory.

+-----------------------------------------------------------------------------+
|i1 : C = linearCode(GF(8,Variable => b),                                     |
|-----------------------------------------------------------------------------|
|{{1,1,b,0,0},{0,b,b,1,0},{1,1,1,b,0}});                                      |
+-----------------------------------------------------------------------------+
|i2 : C.Code                                                                  |
|                                                                             |
|o2 = image | 1 0 1 |                                                         |
|           | 1 b 1 |                                                         |
|           | b b 1 |                                                         |
|           | 0 1 b |                                                         |
|           | 0 0 0 |                                                         |
|                                                                             |
|                                     5                                       |
|o2 : GF 8-module, submodule of (GF 8)                                        |
+-----------------------------------------------------------------------------+

For the programmer
==================

The object Code, is a symbol (Macaulay2Doc).

codewords -- codewords of the code
**********************************

Synopsis
========

  * Usage:
        codewords(C)
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

Obtains all the codewords of a code C by multiplying all the elements of the
ambient space (obtained with the function messages) by the generator matrix of
C.

+-----------------------------------------------------------------------------+
|i1 : F=GF(4,Variable=>a);                                                    |
+-----------------------------------------------------------------------------+
|i2 : C=linearCode(matrix{{1,a,0},{0,1,a}});                                  |
+-----------------------------------------------------------------------------+
|i3 : codewords(C)                                                            |
|                                                                             |
|o3 = {{a, 1, a + 1}, {0, a, a + 1}, {0, a + 1, 1}, {1, a + 1, a}, {a + 1, 0, |
|     ------------------------------------------------------------------------|
|     a}, {a, 0, 1}, {a + 1, 1, 0}, {1, a, 0}, {a + 1, a + 1, a + 1}, {1, 0, a|
|     ------------------------------------------------------------------------|
|     + 1}, {a, a + 1, 0}, {0, 0, 0}, {a, a, a}, {a + 1, a, 1}, {1, 1, 1}, {0,|
|     ------------------------------------------------------------------------|
|     1, a}}                                                                  |
|                                                                             |
|o3 : List                                                                    |
+-----------------------------------------------------------------------------+

Ways to use codewords:
======================

  * "codewords(LinearCode)"

For the programmer
==================

The object codewords, is a method function (Macaulay2Doc).

GeneratorMatrix -- gives the generator matrix of a linear code
**************************************************************

Synopsis
========

  * Usage:
        C.GeneratorMatrix
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a matrix (Macaulay2Doc),

Description
===========

Given a linear code C, this symbol is used as a key for storing a generator
matrix of C.

This symbol is provided by the package CodingTheory.

+-----------------------------------------------------------------------------+
|i1 : C = linearCode(GF(8,Variable => b),                                     |
|-----------------------------------------------------------------------------|
|{{1,1,b,0,0},{0,b,b,1,0},{1,1,1,b,0}});                                      |
+-----------------------------------------------------------------------------+
|i2 : C.GeneratorMatrix                                                       |
|                                                                             |
|o2 = | 1 1 b 0 0 |                                                           |
|     | 0 b b 1 0 |                                                           |
|     | 1 1 1 b 0 |                                                           |
|                                                                             |
|                  3           5                                              |
|o2 : Matrix (GF 8)  <-- (GF 8)                                               |
+-----------------------------------------------------------------------------+

For the programmer
==================

The object GeneratorMatrix, is a symbol (Macaulay2Doc).

Related function:

Generators -- list of generators of a code
******************************************

Synopsis
========

  * Usage:
        C.Generators
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

Given a linear code C, this symbol is used as a key for storing the list of
rows of a generator matrix of C.

This symbol is provided by the package CodingTheory.

+-----------------------------------------------------------------------------+
|i1 : C = linearCode(GF(8,Variable => a),                                     |
|-----------------------------------------------------------------------------|
|{{1,1,a,0,0},{0,a,a,1,0},{1,1,1,a,0}});                                      |
+-----------------------------------------------------------------------------+
|i2 : C.Generators                                                            |
|                                                                             |
|o2 = {{1, 1, a, 0, 0}, {0, a, a, 1, 0}, {1, 1, 1, a, 0}}                     |
|                                                                             |
|o2 : List                                                                    |
+-----------------------------------------------------------------------------+

For the programmer
==================

The object Generators, is a symbol (Macaulay2Doc).

informationRate -- information rate of a code
*********************************************

Synopsis
========

  * Usage:
        informationRate C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a rational number (Macaulay2Doc),

Description
===========

Given a linear code C of length $n$ and dimension $k$, this function returns
the number $\frac{k}{n}$, which is known as the information rate of C.

+-------------------------------------+
|i1 : C=linearCode(GF(4),{{1,1,1,1}});|
+-------------------------------------+
|i2 : informationRate C               |
|                                     |
|     1                               |
|o2 = -                               |
|     4                               |
|                                     |
|o2 : QQ                              |
+-------------------------------------+
+------------------------+
|i3 : H=hammingCode(2,3);|
+------------------------+
|i4 : informationRate H  |
|                        |
|     4                  |
|o4 = -                  |
|     7                  |
|                        |
|o4 : QQ                 |
+------------------------+

The next is an example for the class of EvaluationCode.

+-----------------------------------+
|i5 : RM=reedMullerCode(2,3,1);     |
+-----------------------------------+
|i6 : informationRate(RM.LinearCode)|
|                                   |
|     1                             |
|o6 = -                             |
|     2                             |
|                                   |
|o6 : QQ                            |
+-----------------------------------+

Ways to use informationRate:
============================

  * "informationRate(LinearCode)"

For the programmer
==================

The object informationRate, is a method function (Macaulay2Doc).

linearCode -- functions to construct linear codes over Galois fields
********************************************************************

Synopsis
========

  * Usage:
        linearCode(G)
        linearCode(M)
        linearCode(M,L)
        linearCode(F,L)
        linearCode(F,n,L)
        linearCode(p,r,n,L)
  * Inputs:
      * G, a matrix (Macaulay2Doc),
      * M, a module (Macaulay2Doc),
      * F, a Galois field (Macaulay2Doc),
      * p, an integer (Macaulay2Doc),
      * r, an integer (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
  * Optional inputs (Macaulay2Doc),:
      * ParityCheck => ..., default value false
  * Outputs:
      * an instance of the type LinearCode, $C$

Description
===========

We present below the ways in how a linear code $C$ can be defined.

a matrix is given
=================

  * Usage:
        linearCode(G)
  * Inputs:
      * G, a matrix (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Given a matrix G, whose entries are in a Galois field F, this function returns
a linear code $C$ over F.

If no optional input is specified, then the generator matrix of the code $C$ is
G.

If the optional input ParityCheck => true is specified, then the code $C$ is
the dual of the linear code generated by the matrix G.

+-----------------------------------------------------------------------------+
|i1 : F = GF 4;                                                               |
+-----------------------------------------------------------------------------+
|i2 : L = apply({{1,0,1,0},{0,1,1,1}},codeword                                |
|-----------------------------------------------------------------------------|
|->apply(codeword,entry->sub(entry,F)));                                      |
+-----------------------------------------------------------------------------+
|i3 : M = matrix L                                                            |
|                                                                             |
|o3 = | 1 0 1 0 |                                                             |
|     | 0 1 1 1 |                                                             |
|                                                                             |
|             2      4                                                        |
|o3 : Matrix F  <-- F                                                         |
+-----------------------------------------------------------------------------+
|i4 : C = linearCode(M)                                                       |
|                                                                             |
|                                  4                                          |
|o4 = LinearCode{AmbientModule => F                             }             |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                Code => image | 1 0 |                                        |
|                              | 0 1 |                                        |
|                              | 1 1 |                                        |
|                              | 0 1 |                                        |
|                GeneratorMatrix => | 1 0 1 0 |                               |
|                                   | 0 1 1 1 |                               |
|                Generators => {{1, 0, 1, 0}, {0, 1, 1, 1}}                   |
|                ParityCheckMatrix => | 1 1 1 0 |                             |
|                                     | 0 1 0 1 |                             |
|                ParityCheckRows => {{1, 1, 1, 0}, {0, 1, 0, 1}}              |
|                                                                             |
|o4 : LinearCode                                                              |
+-----------------------------------------------------------------------------+
|i5 : C.GeneratorMatrix                                                       |
|                                                                             |
|o5 = | 1 0 1 0 |                                                             |
|     | 0 1 1 1 |                                                             |
|                                                                             |
|             2      4                                                        |
|o5 : Matrix F  <-- F                                                         |
+-----------------------------------------------------------------------------+
|i6 : C.ParityCheckMatrix                                                     |
|                                                                             |
|o6 = | 1 1 1 0 |                                                             |
|     | 0 1 0 1 |                                                             |
|                                                                             |
|             2      4                                                        |
|o6 : Matrix F  <-- F                                                         |
+-----------------------------------------------------------------------------+

This is an example using the optional argument ParityCheck=>true.

+-----------------------------------------------------------------------------+
|i7 : F = GF(4,Variable => a);                                                |
+-----------------------------------------------------------------------------+
|i8 : L = {{1,0,a,0,0},{0,a,a+1,1,0},{1,1,1,a,0}};                            |
+-----------------------------------------------------------------------------+
|i9 : M = matrix L;                                                           |
|                                                                             |
|             3      5                                                        |
|o9 : Matrix F  <-- F                                                         |
+-----------------------------------------------------------------------------+
|i10 : C = linearCode(F,L,ParityCheck => true)                                |
|                                                                             |
|                                   5                                         |
|o10 = LinearCode{AmbientModule => F                                          |
|                 BaseField => F                                              |
|                 cache => CacheTable{}                                       |
|                 Code => image | a 0 |                                       |
|                               | 1 0 |                                       |
|                               | 1 0 |                                       |
|                               | 1 0 |                                       |
|                               | 0 1 |                                       |
|                 GeneratorMatrix => | a 1 1 1 0 |                            |
|                                    | 0 0 0 0 1 |                            |
|                 Generators => {{a, 1, 1, 1, 0}, {0, 0, 0, 0, 1}}            |
|                 ParityCheckMatrix => | 1 0 a   0 0 |                        |
|                                      | 0 a a+1 1 0 |                        |
|                                      | 1 1 1   a 0 |                        |
|                 ParityCheckRows => {{1, 0, a, 0, 0}, {0, a, a + 1, 1, 0},   |
|                                                                             |
|o10 : LinearCode                                                             |
|-----------------------------------------------------------------------------|
|                }                                                            |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{1, 1, 1, a, 0}}                                                             |
+-----------------------------------------------------------------------------+
|i11 : C.GeneratorMatrix                                                      |
|                                                                             |
|o11 = | a 1 1 1 0 |                                                          |
|      | 0 0 0 0 1 |                                                          |
|                                                                             |
|              2      5                                                       |
|o11 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+
|i12 : C.ParityCheckMatrix                                                    |
|                                                                             |
|o12 = | 1 0 a   0 0 |                                                        |
|      | 0 a a+1 1 0 |                                                        |
|      | 1 1 1   a 0 |                                                        |
|                                                                             |
|              3      5                                                       |
|o12 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+

a module is given
=================

  * Usage:
        linearCode(M)
  * Inputs:
      * M, a module (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Given a submodule M of a free module F$^n$, where $F$ is a Galois field, this
function returns a linear code $C$ whose ambient space is F$^n$.

If no optional input is specified, then the code $C$ is generated by the
elements of M.

If the optional input ParityCheck => true is specified, then the code $C$ is
the dual of the linear code generated by the elements of M.

+-----------------------------------------------------------------------------+
|i13 : F = GF 2; G = transpose matrix {apply({1,1,1,1},entry ->               |
|                                                                             |
|              4      1                                                       |
|o14 : Matrix F  <-- F                                                        |
|-----------------------------------------------------------------------------|
|sub(entry,F))};                                                              |
+-----------------------------------------------------------------------------+
|i15 : M = image G;                                                           |
+-----------------------------------------------------------------------------+
|i16 : C = linearCode(M)                                                      |
|                                                                             |
|                                   4                                         |
|o16 = LinearCode{AmbientModule => F                                          |
|                 BaseField => F                                              |
|                 cache => CacheTable{}                                       |
|                 Code => image | 1 |                                         |
|                               | 1 |                                         |
|                               | 1 |                                         |
|                               | 1 |                                         |
|                 GeneratorMatrix => | 1 1 1 1 |                              |
|                 Generators => {{1, 1, 1, 1}}                                |
|                 ParityCheckMatrix => | 1 1 0 0 |                            |
|                                      | 1 0 1 0 |                            |
|                                      | 1 0 0 1 |                            |
|                 ParityCheckRows => {{1, 1, 0, 0}, {1, 0, 1, 0}, {1, 0, 0,   |
|                                                                             |
|o16 : LinearCode                                                             |
|-----------------------------------------------------------------------------|
|   }                                                                         |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1}}                                                                          |
+-----------------------------------------------------------------------------+
|i17 : C.AmbientModule                                                        |
|                                                                             |
|       4                                                                     |
|o17 = F                                                                      |
|                                                                             |
|o17 : F-module, free                                                         |
+-----------------------------------------------------------------------------+
|i18 : C.BaseField                                                            |
|                                                                             |
|o18 = F                                                                      |
|                                                                             |
|o18 : GaloisField                                                            |
+-----------------------------------------------------------------------------+
|i19 : C.GeneratorMatrix                                                      |
|                                                                             |
|o19 = | 1 1 1 1 |                                                            |
|                                                                             |
|              1      4                                                       |
|o19 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+
|i20 : C.ParityCheckMatrix                                                    |
|                                                                             |
|o20 = | 1 1 0 0 |                                                            |
|      | 1 0 1 0 |                                                            |
|      | 1 0 0 1 |                                                            |
|                                                                             |
|              3      4                                                       |
|o20 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+

a module and a list are given
=============================

  * Usage:
        linearCode(M,L)
  * Inputs:
      * M, a module (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Given a free module M$=F^n$, where $F$ is a Galois field, and a non-empty list
L of vectors of M, this function returns a linear code $C$ whose ambient space
is $F^n$.

If no optional input is specified, then the code $C$ is generated by the
vectors of L.

If the optional input ParityCheck => true is specified, then the code $C$ is
the dual of the linear code generated by the vectors of L.

+-----------------------------------------------------------------------------+
|i21 : F = GF(4,Variable => a); M = F^5; L =                                  |
|-----------------------------------------------------------------------------|
|{{1,0,a,0,0},{0,a,a+1,1,0},{1,1,1,a,0}};                                     |
+-----------------------------------------------------------------------------+
|i24 : C = linearCode(M,L)                                                    |
|                                                                             |
|                                   5                                         |
|o24 = LinearCode{AmbientModule => F                                          |
|                 BaseField => F                                              |
|                 cache => CacheTable{}                                       |
|                 Code => image | 1 0   1 |                                   |
|                               | 0 a   1 |                                   |
|                               | a a+1 1 |                                   |
|                               | 0 1   a |                                   |
|                               | 0 0   0 |                                   |
|                 GeneratorMatrix => | 1 0 a   0 0 |                          |
|                                    | 0 a a+1 1 0 |                          |
|                                    | 1 1 1   a 0 |                          |
|                 Generators => {{1, 0, a, 0, 0}, {0, a, a + 1, 1, 0},        |
|                 ParityCheckMatrix => | 1 a+1 a+1 a+1 0 |                    |
|                                      | 0 0   0   0   1 |                    |
|                 ParityCheckRows => {{1, a + 1, a + 1, a + 1, 0}, {0,        |
|                                                                             |
|o24 : LinearCode                                                             |
|-----------------------------------------------------------------------------|
|                }                                                            |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{1, 1, 1, a, 0}}                                                             |
|                                                                             |
|                                                                             |
|0, 0, 0, 1}}                                                                 |
+-----------------------------------------------------------------------------+
|i25 : C.AmbientModule                                                        |
|                                                                             |
|       5                                                                     |
|o25 = F                                                                      |
|                                                                             |
|o25 : F-module, free                                                         |
+-----------------------------------------------------------------------------+
|i26 : C.BaseField                                                            |
|                                                                             |
|o26 = F                                                                      |
|                                                                             |
|o26 : GaloisField                                                            |
+-----------------------------------------------------------------------------+
|i27 : C.Generators                                                           |
|                                                                             |
|o27 = {{1, 0, a, 0, 0}, {0, a, a + 1, 1, 0}, {1, 1, 1, a, 0}}                |
|                                                                             |
|o27 : List                                                                   |
+-----------------------------------------------------------------------------+
|i28 : C.GeneratorMatrix                                                      |
|                                                                             |
|o28 = | 1 0 a   0 0 |                                                        |
|      | 0 a a+1 1 0 |                                                        |
|      | 1 1 1   a 0 |                                                        |
|                                                                             |
|              3      5                                                       |
|o28 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+
|i29 : C.ParityCheckMatrix                                                    |
|                                                                             |
|o29 = | 1 a+1 a+1 a+1 0 |                                                    |
|      | 0 0   0   0   1 |                                                    |
|                                                                             |
|              2      5                                                       |
|o29 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+
|i30 : C.Code                                                                 |
|                                                                             |
|o30 = image | 1 0   1 |                                                      |
|            | 0 a   1 |                                                      |
|            | a a+1 1 |                                                      |
|            | 0 1   a |                                                      |
|            | 0 0   0 |                                                      |
|                                                                             |
|                              5                                              |
|o30 : F-module, submodule of F                                               |
+-----------------------------------------------------------------------------+

This is an example using the optional argument ParityCheck=>true.

+--------------------------------------------------------------------------+
|i31 : F = GF(8,Variable =>a); M = F^4; L = {{a+1,a+1,a+1,a+1}};           |
+--------------------------------------------------------------------------+
|i34 : C = linearCode(M,L,ParityCheck => true)                             |
|                                                                          |
|                                   4                                      |
|o34 = LinearCode{AmbientModule => F                                      }|
|                 BaseField => F                                           |
|                 cache => CacheTable{}                                    |
|                 Code => image | 1 1 1 |                                  |
|                               | 1 0 0 |                                  |
|                               | 0 1 0 |                                  |
|                               | 0 0 1 |                                  |
|                 GeneratorMatrix => | 1 1 0 0 |                           |
|                                    | 1 0 1 0 |                           |
|                                    | 1 0 0 1 |                           |
|                 Generators => {{1, 1, 0, 0}, {1, 0, 1, 0}, {1, 0, 0, 1}} |
|                 ParityCheckMatrix => | a+1 a+1 a+1 a+1 |                 |
|                 ParityCheckRows => {{a + 1, a + 1, a + 1, a + 1}}        |
|                                                                          |
|o34 : LinearCode                                                          |
+--------------------------------------------------------------------------+
|i35 : G = C.GeneratorMatrix                                               |
|                                                                          |
|o35 = | 1 1 0 0 |                                                         |
|      | 1 0 1 0 |                                                         |
|      | 1 0 0 1 |                                                         |
|                                                                          |
|              3      4                                                    |
|o35 : Matrix F  <-- F                                                     |
+--------------------------------------------------------------------------+
|i36 : H = C.ParityCheckMatrix                                             |
|                                                                          |
|o36 = | a+1 a+1 a+1 a+1 |                                                 |
|                                                                          |
|              1      4                                                    |
|o36 : Matrix F  <-- F                                                     |
+--------------------------------------------------------------------------+

a Galois field and a list are given
===================================

  * Usage:
        linearCode(F,L)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Given a Galois field F, and a non-empty list L of vectors of the same size and
whose entries are coercible into the field F, this function returns a linear
code $C$ over the field F.

If no optional input is specified, then the code $C$ is generated by the
vectors of L.

If the optional input ParityCheck => true is specified, then the code $C$ is
the dual of the linear code generated by the vectors of L.

+-----------------------------------------------------------------------------+
|i37 : F = GF 4; L = {{1,0,1,0},{1,0,1,0}};                                   |
+-----------------------------------------------------------------------------+
|i39 : C = linearCode(F,L)                                                    |
|                                                                             |
|                                   4                                         |
|o39 = LinearCode{AmbientModule => F                                          |
|                 BaseField => F                                              |
|                 cache => CacheTable{}                                       |
|                 Code => image | 1 1 |                                       |
|                               | 0 0 |                                       |
|                               | 1 1 |                                       |
|                               | 0 0 |                                       |
|                 GeneratorMatrix => | 1 0 1 0 |                              |
|                                    | 1 0 1 0 |                              |
|                 Generators => {{1, 0, 1, 0}, {1, 0, 1, 0}}                  |
|                 ParityCheckMatrix => | 0 1 0 0 |                            |
|                                      | 1 0 1 0 |                            |
|                                      | 0 0 0 1 |                            |
|                 ParityCheckRows => {{0, 1, 0, 0}, {1, 0, 1, 0}, {0, 0, 0,   |
|                                                                             |
|o39 : LinearCode                                                             |
|-----------------------------------------------------------------------------|
|   }                                                                         |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1}}                                                                          |
+-----------------------------------------------------------------------------+
|i40 : C.GeneratorMatrix                                                      |
|                                                                             |
|o40 = | 1 0 1 0 |                                                            |
|      | 1 0 1 0 |                                                            |
|                                                                             |
|              2      4                                                       |
|o40 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+
|i41 : C.ParityCheckMatrix                                                    |
|                                                                             |
|o41 = | 0 1 0 0 |                                                            |
|      | 1 0 1 0 |                                                            |
|      | 0 0 0 1 |                                                            |
|                                                                             |
|              3      4                                                       |
|o41 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+

This is an example using the optional argument ParityCheck=>true.

+-----------------------------------------------------------------------------+
|i42 : F = GF(9,Variable => a); L = {{1,0,a,0,0},{0,a,a+1,1,0},{1,1,1,a,0}};  |
+-----------------------------------------------------------------------------+
|i44 : C = linearCode(F,L,ParityCheck => true)                                |
|                                                                             |
|                                   5                                         |
|o44 = LinearCode{AmbientModule => F                                          |
|                 BaseField => F                                              |
|                 cache => CacheTable{}                                       |
|                 Code => image | a-1 0 |                                     |
|                               | 0   0 |                                     |
|                               | a+1 0 |                                     |
|                               | 1   0 |                                     |
|                               | 0   1 |                                     |
|                 GeneratorMatrix => | a-1 0 a+1 1 0 |                        |
|                                    | 0   0 0   0 1 |                        |
|                 Generators => {{a - 1, 0, a + 1, 1, 0}, {0, 0, 0, 0, 1}}    |
|                 ParityCheckMatrix => | 1 0 a   0 0 |                        |
|                                      | 0 a a+1 1 0 |                        |
|                                      | 1 1 1   a 0 |                        |
|                 ParityCheckRows => {{1, 0, a, 0, 0}, {0, a, a + 1, 1, 0},   |
|                                                                             |
|o44 : LinearCode                                                             |
|-----------------------------------------------------------------------------|
|                }                                                            |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{1, 1, 1, a, 0}}                                                             |
+-----------------------------------------------------------------------------+
|i45 : C.GeneratorMatrix                                                      |
|                                                                             |
|o45 = | a-1 0 a+1 1 0 |                                                      |
|      | 0   0 0   0 1 |                                                      |
|                                                                             |
|              2      5                                                       |
|o45 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+
|i46 : C.ParityCheckMatrix                                                    |
|                                                                             |
|o46 = | 1 0 a   0 0 |                                                        |
|      | 0 a a+1 1 0 |                                                        |
|      | 1 1 1   a 0 |                                                        |
|                                                                             |
|              3      5                                                       |
|o46 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+

a Galois field, a positive integer and a list are given
=======================================================

  * Usage:
        linearCode(F,n,L)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Given a Galois field F, a positive integer n, and a non-empty list L of vectors
of size n and entries that are coercible into the field F, this function
returns a linear code $C$ of length n over the field F.

If no optional input is specified, then the code $C$ is generated by the
vectors of L.

If the optional input ParityCheck => true is specified, then the code $C$ is
the dual of the linear code generated by the vectors of L.

+-----------------------------------------------------------------------------+
|i47 : F = GF 4; n = 4; L = {{1,0,1,0},{1,0,1,0}};                            |
+-----------------------------------------------------------------------------+
|i50 : C = linearCode(F,n,L)                                                  |
|                                                                             |
|                                   4                                         |
|o50 = LinearCode{AmbientModule => F                                          |
|                 BaseField => F                                              |
|                 cache => CacheTable{}                                       |
|                 Code => image | 1 1 |                                       |
|                               | 0 0 |                                       |
|                               | 1 1 |                                       |
|                               | 0 0 |                                       |
|                 GeneratorMatrix => | 1 0 1 0 |                              |
|                                    | 1 0 1 0 |                              |
|                 Generators => {{1, 0, 1, 0}, {1, 0, 1, 0}}                  |
|                 ParityCheckMatrix => | 0 1 0 0 |                            |
|                                      | 1 0 1 0 |                            |
|                                      | 0 0 0 1 |                            |
|                 ParityCheckRows => {{0, 1, 0, 0}, {1, 0, 1, 0}, {0, 0, 0,   |
|                                                                             |
|o50 : LinearCode                                                             |
|-----------------------------------------------------------------------------|
|   }                                                                         |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1}}                                                                          |
+-----------------------------------------------------------------------------+
|i51 : C.GeneratorMatrix                                                      |
|                                                                             |
|o51 = | 1 0 1 0 |                                                            |
|      | 1 0 1 0 |                                                            |
|                                                                             |
|              2      4                                                       |
|o51 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+
|i52 : C.ParityCheckMatrix                                                    |
|                                                                             |
|o52 = | 0 1 0 0 |                                                            |
|      | 1 0 1 0 |                                                            |
|      | 0 0 0 1 |                                                            |
|                                                                             |
|              3      4                                                       |
|o52 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+

This is an example using the optional argument ParityCheck=>true.

+-----------------------------------------------------------------------------+
|i53 : F = GF(9,Variable => a); n = 5; L =                                    |
|-----------------------------------------------------------------------------|
|{{1,0,a,0,0},{0,a,a+1,1,0},{1,1,1,a,0}};                                     |
+-----------------------------------------------------------------------------+
|i56 : C = linearCode(F,n,L,ParityCheck => true)                              |
|                                                                             |
|                                   5                                         |
|o56 = LinearCode{AmbientModule => F                                          |
|                 BaseField => F                                              |
|                 cache => CacheTable{}                                       |
|                 Code => image | a-1 0 |                                     |
|                               | 0   0 |                                     |
|                               | a+1 0 |                                     |
|                               | 1   0 |                                     |
|                               | 0   1 |                                     |
|                 GeneratorMatrix => | a-1 0 a+1 1 0 |                        |
|                                    | 0   0 0   0 1 |                        |
|                 Generators => {{a - 1, 0, a + 1, 1, 0}, {0, 0, 0, 0, 1}}    |
|                 ParityCheckMatrix => | 1 0 a   0 0 |                        |
|                                      | 0 a a+1 1 0 |                        |
|                                      | 1 1 1   a 0 |                        |
|                 ParityCheckRows => {{1, 0, a, 0, 0}, {0, a, a + 1, 1, 0},   |
|                                                                             |
|o56 : LinearCode                                                             |
|-----------------------------------------------------------------------------|
|                }                                                            |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{1, 1, 1, a, 0}}                                                             |
+-----------------------------------------------------------------------------+
|i57 : C.GeneratorMatrix                                                      |
|                                                                             |
|o57 = | a-1 0 a+1 1 0 |                                                      |
|      | 0   0 0   0 1 |                                                      |
|                                                                             |
|              2      5                                                       |
|o57 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+
|i58 : C.ParityCheckMatrix                                                    |
|                                                                             |
|o58 = | 1 0 a   0 0 |                                                        |
|      | 0 a a+1 1 0 |                                                        |
|      | 1 1 1   a 0 |                                                        |
|                                                                             |
|              3      5                                                       |
|o58 : Matrix F  <-- F                                                        |
+-----------------------------------------------------------------------------+

a prime number, two positive integers and a list are given
==========================================================

  * Usage:
        linearCode(p,r,n,L)
  * Inputs:
      * p, an integer (Macaulay2Doc),
      * r, an integer (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),
      * L, a list (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Given a prime number p, positive integers r and n, and a non-empty list L of
vectors of size n and entries that are coercible into the Galois field
GF$(\mathtt{p}^\mathtt{r})$, this function returns a linear code $C$ of length
n over the Galois field GF$(\mathtt{p}^\mathtt{r})$.

If no optional input is specified, then the code $C$ is generated by the
vectors of L.

If the optional input ParityCheck => true is specified, then the code $C$ is
the dual of the linear code generated by the vectors of L.

+-----------------------------------------------------------------------------+
|i59 : p = 2; r = 2; n=4; L = {{1,0,1,0},{0,1,1,1}};                          |
+-----------------------------------------------------------------------------+
|i63 : C=linearCode(p,r,n,L)                                                  |
|                                                                             |
|                                        4                                    |
|o63 = LinearCode{AmbientModule => (GF 4)                        }            |
|                 BaseField => GF 4                                           |
|                 cache => CacheTable{}                                       |
|                 Code => image | 1 0 |                                       |
|                               | 0 1 |                                       |
|                               | 1 1 |                                       |
|                               | 0 1 |                                       |
|                 GeneratorMatrix => | 1 0 1 0 |                              |
|                                    | 0 1 1 1 |                              |
|                 Generators => {{1, 0, 1, 0}, {0, 1, 1, 1}}                  |
|                 ParityCheckMatrix => | 1 1 1 0 |                            |
|                                      | 0 1 0 1 |                            |
|                 ParityCheckRows => {{1, 1, 1, 0}, {0, 1, 0, 1}}             |
|                                                                             |
|o63 : LinearCode                                                             |
+-----------------------------------------------------------------------------+
|i64 : p = 3; r = 2; n = 5;                                                   |
+-----------------------------------------------------------------------------+
|i67 : ambient GF(p,r)                                                        |
|                                                                             |
|         ZZ                                                                  |
|         --[a]                                                               |
|          3                                                                  |
|o67 = ----------                                                             |
|       2                                                                     |
|      a  - a - 1                                                             |
|                                                                             |
|o67 : QuotientRing                                                           |
+-----------------------------------------------------------------------------+
|i68 : L = {{1,0,a,0,0},{0,a,a+1,1,0},{1,1,1,a+1,0}};                         |
+-----------------------------------------------------------------------------+
|i69 : C=linearCode(p,r,n,L)                                                  |
|                                                                             |
|                                        5                                    |
|o69 = LinearCode{AmbientModule => (GF 9)                                     |
|                 BaseField => GF 9                                           |
|                 cache => CacheTable{}                                       |
|                 Code => image | 1 0   1   |                                 |
|                               | 0 a   1   |                                 |
|                               | a a+1 1   |                                 |
|                               | 0 1   a+1 |                                 |
|                               | 0 0   0   |                                 |
|                 GeneratorMatrix => | 1 0 a   0   0 |                        |
|                                    | 0 a a+1 1   0 |                        |
|                                    | 1 1 1   a+1 0 |                        |
|                 Generators => {{1, 0, a, 0, 0}, {0, a, a + 1, 1,            |
|                 ParityCheckMatrix => | 1 -1 -a+1 -a 0 |                     |
|                                      | 0 0  0    0  1 |                     |
|                 ParityCheckRows => {{1, -1, - a + 1, -a, 0}, {0,            |
|                                                                             |
|o69 : LinearCode                                                             |
|-----------------------------------------------------------------------------|
|                        }                                                    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {1, 1, 1, a + 1, 0}}                                                     |
|                                                                             |
|                                                                             |
|0, 0, 0, 1}}                                                                 |
+-----------------------------------------------------------------------------+

Caveat
======

While some functions may work even when a ring is given, instead of a finite
field, it is possible that the results are not the expected ones.

Ways to use linearCode:
=======================

  * "linearCode(GaloisField,List)"
  * "linearCode(GaloisField,ZZ,List)"
  * "linearCode(Matrix)"
  * "linearCode(Module)"
  * "linearCode(Module,List)"
  * "linearCode(ZZ,ZZ,ZZ,List)"

For the programmer
==================

The object linearCode, is a method function with options (Macaulay2Doc).

Constructions of linear codes

cyclicCode -- cyclic codes
**************************

Synopsis
========

  * Usage:
        cyclicCode(F, g, n)
        cyclicCode(F, m, n)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * g, a ring element (Macaulay2Doc),
      * m, an integer (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Description
===========

A linear code is called cyclic if $(a_{n},a_1,\ldots,a_{n-1})\in C$ for all
$(a_1,a_2,\ldots,a_n)\in C$. A cyclic code can be defined by a polynomial.

a polynomial is given
=====================

  * Usage:
        cyclicCode(F,g,n)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * g, a ring element (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),

Given a finite field F, an integer n, and a polynomial g in F$[x]\setminus$F
that is a divisor of $x^n-1$, this function returns the cyclic code $C$ with
generating polynomial g and length n.

If the polynomial g is not a divisor of $x^n-1$, the function returns a code
with a circulant matrix as generator matrix.

+-----------------------------------------------------------------------------+
|i1 : F=GF(5);                                                                |
+-----------------------------------------------------------------------------+
|i2 : R=F[x];                                                                 |
+-----------------------------------------------------------------------------+
|i3 : g=x-1;                                                                  |
+-----------------------------------------------------------------------------+
|i4 : C=cyclicCode(F,g,8)                                                     |
|                                                                             |
|                                  8                                          |
|o4 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                Code => image | -1 0  0  0  0  0  0  |                       |
|                              | 1  -1 0  0  0  0  0  |                       |
|                              | 0  1  -1 0  0  0  0  |                       |
|                              | 0  0  1  -1 0  0  0  |                       |
|                              | 0  0  0  1  -1 0  0  |                       |
|                              | 0  0  0  0  1  -1 0  |                       |
|                              | 0  0  0  0  0  1  -1 |                       |
|                              | 0  0  0  0  0  0  1  |                       |
|                GeneratorMatrix => | -1 1  0  0  0  0  0  0 |                |
|                                   | 0  -1 1  0  0  0  0  0 |                |
|                                   | 0  0  -1 1  0  0  0  0 |                |
|                                   | 0  0  0  -1 1  0  0  0 |                |
|                                   | 0  0  0  0  -1 1  0  0 |                |
|                                   | 0  0  0  0  0  -1 1  0 |                |
|                                   | 0  0  0  0  0  0  -1 1 |                |
|                Generators => {{-1, 1, 0, 0, 0, 0, 0, 0}, {0, -1, 1, 0, 0, 0,|
|                ParityCheckMatrix => | 1 1 1 1 1 1 1 1 |                     |
|                ParityCheckRows => {{1, 1, 1, 1, 1, 1, 1, 1}}                |
|                                                                             |
|o4 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0, 0}, {0, 0, -1, 1, 0, 0, 0, 0}, {0, 0, 0, -1, 1, 0, 0, 0}, {0, 0, 0, 0, -1,|
|-----------------------------------------------------------------------------|
|                                                               }             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, 0, 0}, {0, 0, 0, 0, 0, -1, 1, 0}, {0, 0, 0, 0, 0, 0, -1, 1}}              |
+-----------------------------------------------------------------------------+

a constant polynomial is given
==============================

  * Usage:
        cyclicCode(F, m, n)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * m, an integer (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),

If m is a nonzero constant, then this function returns the universal code of
length n over the field F.

If m is zero, then this function returns the zero code of length n.

+-----------------------------------------------------------------------------+
|i5 : F=GF(5);                                                                |
+-----------------------------------------------------------------------------+
|i6 : R=F[x];                                                                 |
+-----------------------------------------------------------------------------+
|i7 : C=cyclicCode(F,0,5)                                                     |
|                                                                             |
|                                  5                                          |
|o7 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                GeneratorMatrix => 0                                         |
|                Generators => {{}}                                           |
|                ParityCheckMatrix => | 1 0 0 0 0 |                           |
|                                     | 0 1 0 0 0 |                           |
|                                     | 0 0 1 0 0 |                           |
|                                     | 0 0 0 1 0 |                           |
|                                     | 0 0 0 0 1 |                           |
|                ParityCheckRows => {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, |
|                                                                             |
|o7 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                           }                                 |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}                                  |
+-----------------------------------------------------------------------------+
|i8 : C=cyclicCode(F,2,5)                                                     |
|                                                                             |
|                                  5                                          |
|o8 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                GeneratorMatrix => | 1 0 0 0 0 |                             |
|                                   | 0 1 0 0 0 |                             |
|                                   | 0 0 1 0 0 |                             |
|                                   | 0 0 0 1 0 |                             |
|                                   | 0 0 0 0 1 |                             |
|                Generators => {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0,|
|                ParityCheckMatrix => 0                                       |
|                ParityCheckRows => {{}}                                      |
|                                                                             |
|o8 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                     }                                       |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}                                        |
+-----------------------------------------------------------------------------+

Ways to use cyclicCode:
=======================

  * "cyclicCode(GaloisField,RingElement,ZZ)"
  * "cyclicCode(GaloisField,ZZ,ZZ)"

For the programmer
==================

The object cyclicCode, is a method function (Macaulay2Doc).

Related functions:

cyclicMatrix -- cyclic matrix
*****************************

Synopsis
========

  * Usage:
        cyclicMatrix(v)
        cyclicMatrix(F,v)
  * Inputs:
      * v, a list (Macaulay2Doc),
      * F, a Galois field (Macaulay2Doc),
  * Outputs:
      * a matrix (Macaulay2Doc), $M$

Description
===========

A cyclic matrix (also known as circulant matrix) is a square matrix whose every
row (starting from the second) is the right cyclic shift by one entry of the
previous row. Below we present ways to define a cyclic matrix $M$.

a list is given
===============

  * Usage:
        cyclicMatrix(v)
  * Inputs:
      * v, a list (Macaulay2Doc),
  * Outputs:
      * a matrix (Macaulay2Doc), $M$

Assume that $v_1,\ldots,v_n$ are the entries of v. The output is an $n\times n$
matrix. The entries of row 1 are $v_1,\ldots,v_n$, the entries of row 2 are
$v_2,\ldots,v_n,v_1$, in general, the entries of row $i$ are
$v_i,\ldots,v_n,v_1,\ldots, v_{i-1}$.

+-----------------------+
|i1 : v=toList(1,0,2,0);|
+-----------------------+
|i2 : M =cyclicMatrix(v)|
|                       |
|o2 = | 1 0 2 0 |       |
|     | 0 1 0 2 |       |
|     | 2 0 1 0 |       |
|     | 0 2 0 1 |       |
|                       |
|              4       4|
|o2 : Matrix ZZ  <-- ZZ |
+-----------------------+

a finite field and a list are given
===================================

  * Usage:
        cyclicMatrix(v,F)
  * Inputs:
      * v, a list (Macaulay2Doc),
      * F, a Galois field (Macaulay2Doc),
  * Outputs:
      * a matrix (Macaulay2Doc), $M$

Assume that $v_1,\ldots,v_n$ are the entries of v. The output is an $n\times n$
matrix over F. The entries of row 1 are $v_1,\ldots,v_n$, the entries of row 2
are $v_2,\ldots,v_n,v_1$, in general, the entries of row $i$ are
$v_i,\ldots,v_n,v_1,\ldots, v_{i-1}$.

+-------------------------+
|i3 : F=GF(4,Variable=>a);|
+-------------------------+
|i4 : v={0,1,a};          |
+-------------------------+
|i5 : M=cyclicMatrix(F,v) |
|                         |
|o5 = | 0 1 a |           |
|     | a 0 1 |           |
|     | 1 a 0 |           |
|                         |
|             3      3    |
|o5 : Matrix F  <-- F     |
+-------------------------+

Ways to use cyclicMatrix:
=========================

  * "cyclicMatrix(GaloisField,List)"
  * "cyclicMatrix(List)"

For the programmer
==================

The object cyclicMatrix, is a method function (Macaulay2Doc).

quasiCyclicCode -- constructs a quasi-cyclic code
*************************************************

Synopsis
========

  * Usage:
        quasiCyclicCode(L)
        quasiCyclicCode(F,L)
  * Inputs:
      * L, a list (Macaulay2Doc),
      * F, a Galois field (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Description
===========

We present below the ways in how a quasi-cyclic code $C$ can be defined.

a list is given
===============

  * Usage:
        quasiCyclicCode(L)
  * Inputs:
      * L, a list (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

L is a list of vectors. Every vector \(v_i\) in L generates a cyclic matrix
$A_i$. Returns the quasi-cyclic code $C$ whose generator matrix is the
concatenation of the matrices $A_i$.

+-----------------------------------------------------------------------------+
|i1 : F = GF(5);                                                              |
+-----------------------------------------------------------------------------+
|i2 : L = apply(toList(1..2),j-> apply(toList(1..4),i-> random(F)));          |
+-----------------------------------------------------------------------------+
|i3 : L                                                                       |
|                                                                             |
|o3 = {{-2, 0, 1, -2}, {0, 2, -2, -1}}                                        |
|                                                                             |
|o3 : List                                                                    |
+-----------------------------------------------------------------------------+
|i4 : C2=quasiCyclicCode(L)                                                   |
|                                                                             |
|                                  4                                          |
|o4 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                Code => image | -2 -2 1  0  0  -1 -2 2  |                    |
|                              | 0  -2 -2 1  2  0  -1 -2 |                    |
|                              | 1  0  -2 -2 -2 2  0  -1 |                    |
|                              | -2 1  0  -2 -1 -2 2  0  |                    |
|                GeneratorMatrix => | -2 0  1  -2 |                           |
|                                   | -2 -2 0  1  |                           |
|                                   | 1  -2 -2 0  |                           |
|                                   | 0  1  -2 -2 |                           |
|                                   | 0  2  -2 -1 |                           |
|                                   | -1 0  2  -2 |                           |
|                                   | -2 -1 0  2  |                           |
|                                   | 2  -2 -1 0  |                           |
|                Generators => {{-2, 0, 1, -2}, {-2, -2, 0, 1}, {1, -2, -2,   |
|                ParityCheckMatrix => 0                                       |
|                ParityCheckRows => {}                                        |
|                                                                             |
|o4 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {0, 1, -2, -2}, {0, 2, -2, -1}, {-1, 0, 2, -2}, {-2, -1, 0, 2}, {2, -2,  |
|-----------------------------------------------------------------------------|
|       }                                                                     |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-1, 0}}                                                                      |
+-----------------------------------------------------------------------------+

a finite field and a list are given
===================================

  * Usage:
        quasiCyclicCode(F,L)
  * Inputs:
      * L, a list (Macaulay2Doc),
      * F, a Galois field (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

L is a list of vectors, whose entries belong to the field F. Every vector
\(v_i\) in L generates a cyclic matrix $A_i$. Returns the quasi-cyclic code $C$
whose generator matrix is the concatenation of the matrices $A_i$.

+-----------------------------------------------------------------------------+
|i5 : F = GF(5);                                                              |
+-----------------------------------------------------------------------------+
|i6 : L = apply(toList(1..2),j-> apply(toList(1..4),i-> random(F)));          |
+-----------------------------------------------------------------------------+
|i7 : L                                                                       |
|                                                                             |
|o7 = {{-2, -2, 0, 0}, {-2, 0, 2, -2}}                                        |
|                                                                             |
|o7 : List                                                                    |
+-----------------------------------------------------------------------------+
|i8 : C2=quasiCyclicCode(F,L)                                                 |
|                                                                             |
|                                  4                                          |
|o8 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                Code => image | -2 0  0  -2 -2 -2 2  0  |                    |
|                              | -2 -2 0  0  0  -2 -2 2  |                    |
|                              | 0  -2 -2 0  2  0  -2 -2 |                    |
|                              | 0  0  -2 -2 -2 2  0  -2 |                    |
|                GeneratorMatrix => | -2 -2 0  0  |                           |
|                                   | 0  -2 -2 0  |                           |
|                                   | 0  0  -2 -2 |                           |
|                                   | -2 0  0  -2 |                           |
|                                   | -2 0  2  -2 |                           |
|                                   | -2 -2 0  2  |                           |
|                                   | 2  -2 -2 0  |                           |
|                                   | 0  2  -2 -2 |                           |
|                Generators => {{-2, -2, 0, 0}, {0, -2, -2, 0}, {0, 0, -2,    |
|                ParityCheckMatrix => 0                                       |
|                ParityCheckRows => {}                                        |
|                                                                             |
|o8 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-2}, {-2, 0, 0, -2}, {-2, 0, 2, -2}, {-2, -2, 0, 2}, {2, -2, -2, 0}, {0, 2,  |
|-----------------------------------------------------------------------------|
|        }                                                                    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-2, -2}}                                                                     |
+-----------------------------------------------------------------------------+

Ways to use quasiCyclicCode:
============================

  * "quasiCyclicCode(GaloisField,List)"
  * "quasiCyclicCode(List)"

For the programmer
==================

The object quasiCyclicCode, is a method function (Macaulay2Doc).

dualCode -- dual of a code
**************************

Synopsis
========

  * Usage:
        dualCode(C)
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * an instance of the type LinearCode,

Description
===========

The dual of a code C of length $n$ over the field $F$ is the code whose
codewords are the elements $v$ in $F^n$ such that for any $c$ in C, the inner
product $<c,v>$ is equal to zero. This function returns the dual of C.

+--------------------------------------------------------------+
|i1 : F=GF(4,Variable=>a);                                     |
+--------------------------------------------------------------+
|i2 : C=linearCode(matrix{{1,a,0},{0,1,a}});                   |
+--------------------------------------------------------------+
|i3 : D=dualCode(C)                                            |
|                                                              |
|                                  3                           |
|o3 = LinearCode{AmbientModule => F                           }|
|                BaseField => F                                |
|                cache => CacheTable{}                         |
|                Code => image | a+1 |                         |
|                              | a   |                         |
|                              | 1   |                         |
|                GeneratorMatrix => | a+1 a 1 |                |
|                Generators => {{a + 1, a, 1}}                 |
|                ParityCheckMatrix => | 1 0 a+1 |              |
|                                     | 0 1 a   |              |
|                ParityCheckRows => {{1, 0, a + 1}, {0, 1, a}} |
|                                                              |
|o3 : LinearCode                                               |
+--------------------------------------------------------------+

Ways to use dualCode:
=====================

  * "dualCode(LinearCode)"

For the programmer
==================

The object dualCode, is a method function (Macaulay2Doc).

genericCode -- ambient space of a code
**************************************

Synopsis
========

  * Usage:
        genericCode(C)
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * an instance of the type LinearCode,

Description
===========

Given a code C over a finite field $F$ of length $n$, returns the code $F^n$.

+----------------------------------------------------------------+
|i1 : F=GF(4,Variable=>a);                                       |
+----------------------------------------------------------------+
|i2 : C=linearCode(matrix{{1,a,0},{0,1,a}})                      |
|                                                                |
|                                  3                             |
|o2 = LinearCode{AmbientModule => F                  }           |
|                BaseField => F                                  |
|                cache => CacheTable{}                           |
|                Code => image | 1 0 |                           |
|                              | a 1 |                           |
|                              | 0 a |                           |
|                GeneratorMatrix => | 1 a 0 |                    |
|                                   | 0 1 a |                    |
|                Generators => {{1, a, 0}, {0, 1, a}}            |
|                ParityCheckMatrix => | 1 a+1 a |                |
|                ParityCheckRows => {{1, a + 1, a}}              |
|                                                                |
|o2 : LinearCode                                                 |
+----------------------------------------------------------------+
|i3 : genericCode(C)                                             |
|                                                                |
|                                  3                             |
|o3 = LinearCode{AmbientModule => F                             }|
|                BaseField => F                                  |
|                cache => CacheTable{}                           |
|                Code => image | 1 0 0 |                         |
|                              | 0 1 0 |                         |
|                              | 0 0 1 |                         |
|                GeneratorMatrix => | 1 0 0 |                    |
|                                   | 0 1 0 |                    |
|                                   | 0 0 1 |                    |
|                Generators => {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} |
|                ParityCheckMatrix => 0                          |
|                ParityCheckRows => {}                           |
|                                                                |
|o3 : LinearCode                                                 |
+----------------------------------------------------------------+

Ways to use genericCode:
========================

  * "genericCode(LinearCode)"

For the programmer
==================

The object genericCode, is a method function (Macaulay2Doc).

hammingCode -- generates a Hamming code
***************************************

Synopsis
========

  * Usage:
        hammingCode(q,s)
  * Inputs:
      * q, an integer (Macaulay2Doc),
      * s, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Description
===========

Returns the Hamming code $C$ over GF(q) whose dual has dimension s.

+-------------------------------+
|i1 : C1 = hammingCode(2,3);    |
+-------------------------------+
|i2 : C1.ParityCheckMatrix      |
|                               |
|o2 = | 1 1 1 1 0 0 0 |         |
|     | 0 0 1 1 1 1 0 |         |
|     | 0 1 0 1 1 0 1 |         |
|                               |
|                  3           7|
|o2 : Matrix (GF 2)  <-- (GF 2) |
+-------------------------------+

Ways to use hammingCode:
========================

  * "hammingCode(ZZ,ZZ)"

For the programmer
==================

The object hammingCode, is a method function (Macaulay2Doc).

locallyRecoverableCode -- constructs a locally recoverable code (LRC)
*********************************************************************

Synopsis
========

  * Usage:
        locallyRecoverableCode(L,A,g)
  * Inputs:
      * L, a list (Macaulay2Doc),
      * A, a list (Macaulay2Doc),
      * g, a ring element (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Description
===========

L is the list $\{q,n,k,r\},$ where $q$ is a prime power, and $n$, $k$ and $r$
are positive integers. A is a list that contains lists of elements of the field
GF(q). Every sublist contains different elements of GF(q). The intersection
between every two sublists is empty. The polynomial g is "good", which means
that is constant on every sublist of A. This function generates an LRC code $C$
of length $n$, dimension $k$, and locality $r$, over GF(q). This code $C$ has
the property that for every $1\leq i \leq n$, there exist $i_1,\ldots,i_r$ such
that for every codeword $c$ in $C$, the entry $c_i$ can be recovered from the
entries $c_{i_1},...,c_{i_r}$. This construction was introduced by Tamo and
Barg in the paper A family of optimal locally recoverable codes:
https://arxiv.org/pdf/1311.3284v2.pdf.

+-----------------------------------------------------------------------------+
|i1 : A={{1,3,9},{2,6,5},{4,12,10}}                                           |
|                                                                             |
|o1 = {{1, 3, 9}, {2, 6, 5}, {4, 12, 10}}                                     |
|                                                                             |
|o1 : List                                                                    |
+-----------------------------------------------------------------------------+
|i2 : R=(ZZ/13)[x]                                                            |
|                                                                             |
|o2 = R                                                                       |
|                                                                             |
|o2 : PolynomialRing                                                          |
+-----------------------------------------------------------------------------+
|i3 : g=x^3                                                                   |
|                                                                             |
|      3                                                                      |
|o3 = x                                                                       |
|                                                                             |
|o3 : R                                                                       |
+-----------------------------------------------------------------------------+
|i4 : locallyRecoverableCode({13,9,4,2},A,g)                                  |
|                                                                             |
|                                        9                                    |
|o4 = LinearCode{AmbientModule => (GF 13)                                     |
|                BaseField => GF 13                                           |
|                cache => CacheTable{}                                        |
|                Code => image | 1 1  1  1  |                                 |
|                              | 1 1  3  3  |                                 |
|                              | 1 1  -4 -4 |                                 |
|                              | 1 -5 2  3  |                                 |
|                              | 1 -5 6  -4 |                                 |
|                              | 1 -5 5  1  |                                 |
|                              | 1 -1 4  -4 |                                 |
|                              | 1 -1 -1 1  |                                 |
|                              | 1 -1 -3 3  |                                 |
|                GeneratorMatrix => | 1 1 1  1  1  1  1  1  1  |              |
|                                   | 1 1 1  -5 -5 -5 -1 -1 -1 |              |
|                                   | 1 3 -4 2  6  5  4  -1 -3 |              |
|                                   | 1 3 -4 3  -4 1  -4 1  3  |              |
|                Generators => {{1, 1, 1, 1, 1, 1, 1, 1, 1}, {1,              |
|                ParityCheckMatrix => | 1 0 0 0 -2 -4 0 -3 -5 |               |
|                                     | 0 1 0 0 -1 -5 0 2  3  |               |
|                                     | 0 0 1 0 2  5  0 4  1  |               |
|                                     | 0 0 0 1 3  -4 0 0  0  |               |
|                                     | 0 0 0 0 0  0  1 3  -4 |               |
|                ParityCheckRows => {{1, 0, 0, 0, -2, -4, 0, -3,              |
|                                                                             |
|o4 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, 1, -5, -5, -5, -1, -1, -1}, {1, 3, -4, 2, 6, 5, 4, -1,                    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-5}, {0, 1, 0, 0, -1, -5, 0, 2, 3}, {0, 0, 1, 0, 2, 5, 0,                    |
|-----------------------------------------------------------------------------|
|                                                                  }          |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-3}, {1, 3, -4, 3, -4, 1, -4, 1, 3}}                                         |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|4, 1}, {0, 0, 0, 1, 3, -4, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 3, -4}}           |
+-----------------------------------------------------------------------------+

Ways to use locallyRecoverableCode:
===================================

  * "locallyRecoverableCode(List,List,RingElement)"

For the programmer
==================

The object locallyRecoverableCode, is a
method function (Macaulay2Doc).

Related function:

getLRCencodingPolynomial -- encoding polynomial for an LRC code
***************************************************************

Synopsis
========

  * Usage:
        getLRCencodingPolynomial(k,r,List,informationList,g)
  * Inputs:
      * k, an integer (Macaulay2Doc),
      * r, an integer (Macaulay2Doc),
      * informationList, a list (Macaulay2Doc),
      * g, a ring element (Macaulay2Doc),
  * Outputs:
      * a ring element (Macaulay2Doc), $f(x)$

Description
===========

Generates an encoding polynomial $f(x)$ corresponding to an information vector
in $F^\texttt{k}$, where $F$ is a field, which can be used to generate an
encoding in $F^\texttt{r}$.

+------------------------------------------------+
|i1 : R=ZZ/(13)[x];                              |
+------------------------------------------------+
|i2 : getLRCencodingPolynomial(4,2,{1,0,1,1},x^3)|
|                                                |
|      4                                         |
|o2 = x  + x + 1                                 |
|                                                |
|o2 : R                                          |
+------------------------------------------------+

Ways to use getLRCencodingPolynomial:
=====================================

  * "getLRCencodingPolynomial(ZZ,ZZ,List,RingElement)"

For the programmer
==================

The object getLRCencodingPolynomial, is a
method function (Macaulay2Doc).

ParityCheck -- an optional input for the linearCode constructor
***************************************************************

Synopsis
========

  * Usage:
        linearCode(..., ParityCheck => ...)

Description
===========

This is a Boolean symbol, returns value false or true. The default value is
false.

This symbol is provided by the package CodingTheory.

+-------------------------------------------------+
|i1 : F = GF(4,Variable => a);                    |
+-------------------------------------------------+
|i2 : L = {{1,0,a,0,0},{0,a,a+1,1,0},{1,1,1,a,0}};|
+-------------------------------------------------+
|i3 : M = matrix L;                               |
|                                                 |
|             3      5                            |
|o3 : Matrix F  <-- F                             |
+-------------------------------------------------+
|i4 : C = linearCode(F,L,ParityCheck => true);    |
+-------------------------------------------------+
|i5 : C.GeneratorMatrix;                          |
|                                                 |
|             2      5                            |
|o5 : Matrix F  <-- F                             |
+-------------------------------------------------+
|i6 : C.ParityCheckMatrix                         |
|                                                 |
|o6 = | 1 0 a   0 0 |                             |
|     | 0 a a+1 1 0 |                             |
|     | 1 1 1   a 0 |                             |
|                                                 |
|             3      5                            |
|o6 : Matrix F  <-- F                             |
+-------------------------------------------------+

Functions with optional argument named ParityCheck:
===================================================

  * "linearCode(...,ParityCheck=>...)" -- see linearCode, --
    functions to construct linear codes over Galois fields

For the programmer
==================

The object ParityCheck, is a symbol (Macaulay2Doc).

Related functions and symbols:

generatorToParityCheck -- parity check matrix of a linear code
**************************************************************

Synopsis
========

  * Usage:
        generatorToParityCheck(G)
  * Inputs:
      * G, a matrix (Macaulay2Doc),
  * Outputs:
      * a matrix (Macaulay2Doc), $H$

Description
===========

Constructs a parity check matrix $H$ of the linear code generated by G.

+-----------------------------------------------------------------------------+
|i1 : F = GF 2;                                                               |
+-----------------------------------------------------------------------------+
|i2 : L = {{0,1,1,0},{1,0,1,0},{0,0,0,1}};                                    |
+-----------------------------------------------------------------------------+
|i3 : G = matrix apply(L, codeword->apply(codeword, en -> sub(en,F)))         |
|                                                                             |
|o3 = | 0 1 1 0 |                                                             |
|     | 1 0 1 0 |                                                             |
|     | 0 0 0 1 |                                                             |
|                                                                             |
|             3      4                                                        |
|o3 : Matrix F  <-- F                                                         |
+-----------------------------------------------------------------------------+
|i4 : H = generatorToParityCheck G                                            |
|                                                                             |
|o4 = | 1 1 1 0 |                                                             |
|                                                                             |
|             1      4                                                        |
|o4 : Matrix F  <-- F                                                         |
+-----------------------------------------------------------------------------+
|i5 : K = GF(8,Variable => a);                                                |
+-----------------------------------------------------------------------------+
|i6 : G = matrix {{1,0,0,a,0,1,1,a},{0,0,0,1,1,1,1,0},{1,1,0,0,0,1,0,0},{1,0,1|
|                                                                             |
|o6 = | 1 0 0 a 0 1 1 a |                                                     |
|     | 0 0 0 1 1 1 1 0 |                                                     |
|     | 1 1 0 0 0 1 0 0 |                                                     |
|     | 1 0 1 0 0 1 1 0 |                                                     |
|                                                                             |
|             4      8                                                        |
|o6 : Matrix K  <-- K                                                         |
|-----------------------------------------------------------------------------|
|,0,0,1,1,0}}                                                                 |
+-----------------------------------------------------------------------------+
|i7 : H = generatorToParityCheck G                                            |
|                                                                             |
|o7 = | 1 0 0 0 1 1 0 0    |                                                  |
|     | 0 1 0 0 0 1 1 0    |                                                  |
|     | 0 0 1 0 1 0 1 a2+1 |                                                  |
|     | 0 0 0 1 1 0 0 1    |                                                  |
|                                                                             |
|             4      8                                                        |
|o7 : Matrix K  <-- K                                                         |
+-----------------------------------------------------------------------------+

Ways to use generatorToParityCheck:
===================================

  * "generatorToParityCheck(Matrix)"

For the programmer
==================

The object generatorToParityCheck, is a
method function (Macaulay2Doc).

ParityCheckMatrix -- a parity check matrix of a code
****************************************************

Synopsis
========

  * Usage:
        C.ParityCheckMatrix
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a matrix (Macaulay2Doc),

Description
===========

This symbol is used as a key for storing a parity check matrix of C.

This symbol is provided by the package CodingTheory.

+-----------------------------------------------------------------------------+
|i1 : C=linearCode(GF(8,Variable => b),                                       |
|-----------------------------------------------------------------------------|
|{{1,1,b,0,0},{0,b,b,1,0},{1,1,1,b,0}});                                      |
+-----------------------------------------------------------------------------+
|i2 : C.ParityCheckMatrix                                                     |
|                                                                             |
|o2 = | 1 b+1 1 b2 0 |                                                        |
|     | 0 0   0 0  1 |                                                        |
|                                                                             |
|                  2           5                                              |
|o2 : Matrix (GF 8)  <-- (GF 8)                                               |
+-----------------------------------------------------------------------------+

See also
========

  * ParityCheckRows -- rows of a parity check matrix of
    a code
  * Generators -- list of generators of a code
  * reducedMatrix -- reduced matrix
  * generatorToParityCheck -- parity check
    matrix of a linear code
  * parityCheckToGenerator -- generator matrix
    given a parity check matrix

For the programmer
==================

The object ParityCheckMatrix, is a symbol (Macaulay2Doc).

ParityCheckRows -- rows of a parity check matrix of a code
**********************************************************

Synopsis
========

  * Usage:
        C.ParityCheckRows
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

This symbol is a key to store a list with the rows of a parity check matrix of
C.

This symbol is provided by the package CodingTheory.

+-----------------------------------------------------------------------------+
|i1 : C = linearCode(GF(8,Variable => b),                                     |
|-----------------------------------------------------------------------------|
|{{1,1,b,0,0},{0,b,b,1,0},{1,1,1,b,0}});                                      |
+-----------------------------------------------------------------------------+
|i2 : C.ParityCheckMatrix                                                     |
|                                                                             |
|o2 = | 1 b+1 1 b2 0 |                                                        |
|     | 0 0   0 0  1 |                                                        |
|                                                                             |
|                  2           5                                              |
|o2 : Matrix (GF 8)  <-- (GF 8)                                               |
+-----------------------------------------------------------------------------+
|i3 : C.ParityCheckRows                                                       |
|                                                                             |
|                     2                                                       |
|o3 = {{1, b + 1, 1, b , 0}, {0, 0, 0, 0, 1}}                                 |
|                                                                             |
|o3 : List                                                                    |
+-----------------------------------------------------------------------------+

See also
========

  * ParityCheckMatrix -- a parity check matrix of a
    code
  * Generators -- list of generators of a code
  * reducedMatrix -- reduced matrix
  * generatorToParityCheck -- parity check
    matrix of a linear code
  * parityCheckToGenerator -- generator matrix
    given a parity check matrix

For the programmer
==================

The object ParityCheckRows, is a symbol (Macaulay2Doc).

parityCheckToGenerator -- generator matrix given a parity check matrix
**********************************************************************

Synopsis
========

  * Usage:
        parityCheckToGenerator H
  * Inputs:
      * H, a matrix (Macaulay2Doc),
  * Outputs:
      * a matrix (Macaulay2Doc), $G$

Description
===========

Given parity check matrix H of a code $C$, this function recovers a generator
matrix G of $C$.

+------------------------------------------------------------------+
|i1 : F = GF 2;                                                    |
+------------------------------------------------------------------+
|i2 : H = matrix apply({{1,1,1,0}},l->apply(l,entry->sub(entry,F)))|
|                                                                  |
|o2 = | 1 1 1 0 |                                                  |
|                                                                  |
|             1      4                                             |
|o2 : Matrix F  <-- F                                              |
+------------------------------------------------------------------+
|i3 : G = parityCheckToGenerator H                                 |
|                                                                  |
|o3 = | 1 1 0 0 |                                                  |
|     | 1 0 1 0 |                                                  |
|     | 0 0 0 1 |                                                  |
|                                                                  |
|             3      4                                             |
|o3 : Matrix F  <-- F                                              |
+------------------------------------------------------------------+
|i4 : H*(transpose G)                                              |
|                                                                  |
|o4 = 0                                                            |
|                                                                  |
|             1      3                                             |
|o4 : Matrix F  <-- F                                              |
+------------------------------------------------------------------+
+--------------------------------------------------------------------------+
|i5 : F = GF(8,Variable => a);                                             |
+--------------------------------------------------------------------------+
|i6 : H = matrix{{1,0,0,0,1,1,0,0},{0,1,0,0,0,1,1,0},{0,0,1,0,1,0,1,a^2+1}}|
|                                                                          |
|o6 = | 1 0 0 0 1 1 0 0    |                                               |
|     | 0 1 0 0 0 1 1 0    |                                               |
|     | 0 0 1 0 1 0 1 a2+1 |                                               |
|                                                                          |
|             3      8                                                     |
|o6 : Matrix F  <-- F                                                      |
+--------------------------------------------------------------------------+
|i7 : G = parityCheckToGenerator H                                         |
|                                                                          |
|o7 = | 0 0 0    1 0 0 0 0 |                                               |
|     | 1 0 1    0 1 0 0 0 |                                               |
|     | 1 1 0    0 0 1 0 0 |                                               |
|     | 0 1 1    0 0 0 1 0 |                                               |
|     | 0 0 a2+1 0 0 0 0 1 |                                               |
|                                                                          |
|             5      8                                                     |
|o7 : Matrix F  <-- F                                                      |
+--------------------------------------------------------------------------+
|i8 : H*(transpose G)                                                      |
|                                                                          |
|o8 = 0                                                                    |
|                                                                          |
|             3      5                                                     |
|o8 : Matrix F  <-- F                                                      |
+--------------------------------------------------------------------------+

Ways to use parityCheckToGenerator:
===================================

  * "parityCheckToGenerator(Matrix)"

For the programmer
==================

The object parityCheckToGenerator, is a
method function (Macaulay2Doc).

randLDPC -- low density parity check matrix
*******************************************

Synopsis
========

  * Usage:
        randLDPC(n, k, m, b)
  * Inputs:
      * n, an integer (Macaulay2Doc),
      * k, an integer (Macaulay2Doc),
      * m, a real number (Macaulay2Doc),
      * b, an integer (Macaulay2Doc),
  * Outputs:
      * a matrix (Macaulay2Doc), $H$

Description
===========

The parameter n indicates the number of columns of $H$. The number of rows of
$H$ is n-k. The real number m indicates the slope of the line which relates n
and the number of ones in $H$. Finally, b indicates the constant term of the
line which relates $n$ and the number of ones in $H$. The number of ones in $H$
is determined by the formula floor(n*m) + b. Since this formula is linear in
the number of columns of $H$, randLDPC produces a sparse matrix, for a fixed
set of parameters n, k, m and b.

+--------------------------------------+
|i1 : randLDPC(15,5,3.0,0)             |
|                                      |
|o1 = | 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 ||
|     | 1 1 0 0 1 0 0 1 0 1 0 0 0 0 0 ||
|     | 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 ||
|     | 1 0 1 0 0 0 0 0 1 1 0 0 0 1 0 ||
|     | 0 0 1 1 0 1 0 1 0 0 0 0 1 1 0 ||
|     | 0 0 1 1 0 0 0 0 0 1 1 1 0 1 0 ||
|     | 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 ||
|     | 1 0 1 0 0 1 0 0 0 1 1 0 0 1 1 ||
|     | 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 ||
|     | 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 ||
|                                      |
|                  10           15     |
|o1 : Matrix (GF 2)   <-- (GF 2)       |
+--------------------------------------+

Ways to use randLDPC:
=====================

  * "randLDPC(ZZ,ZZ,RR,ZZ)"

For the programmer
==================

The object randLDPC, is a method function (Macaulay2Doc).

tannerGraph -- outputs the tanner graph associated with the given parity check matrix
*************************************************************************************

Synopsis
========

  * Usage:
        tannerGraph(H)
  * Inputs:
      * H, a matrix (Macaulay2Doc),
  * Outputs:
      * a graph (Graphs),

Description
===========

Given a linear code $C$ with parity-check matrix H, the function returns the
Tanner graph associated to H. This is a bipartite graph with one set of
vertices indexed by the rows of  H and the other by the columns of H. The
vertex corresponding to the $i$-th row is connected to the vertex corresponding
to the $j$-th column if and only if the $(i,j)$-th entry of H is nonzero.

+-----------------------------------------------------------------------------+
|i1 : H := matrix(GF(2), {{1,1,0,0,0,0,0},{0,1,1,0,0,0,0},                    |
|                                                                             |
|                  6           7                                              |
|o1 : Matrix (GF 2)  <-- (GF 2)                                               |
|-----------------------------------------------------------------------------|
|{0,1,1,1,1,0,0},{0,0,0,1,1,0,0},{0,0,0,0,1,1,0},{0,0,0,0,1,0,1}});           |
+-----------------------------------------------------------------------------+
|i2 : tannerGraph(H)                                                          |
|                                                                             |
|o2 = Graph{c  => {r }            }                                           |
|            0      0                                                         |
|           c  => {r , r , r }                                                |
|            1      0   1   2                                                 |
|           c  => {r , r }                                                    |
|            2      1   2                                                     |
|           c  => {r , r }                                                    |
|            3      2   3                                                     |
|           c  => {r , r , r , r }                                            |
|            4      2   3   4   5                                             |
|           c  => {r }                                                        |
|            5      4                                                         |
|           c  => {r }                                                        |
|            6      5                                                         |
|           r  => {c , c }                                                    |
|            0      0   1                                                     |
|           r  => {c , c }                                                    |
|            1      1   2                                                     |
|           r  => {c , c , c , c }                                            |
|            2      1   2   3   4                                             |
|           r  => {c , c }                                                    |
|            3      3   4                                                     |
|           r  => {c , c }                                                    |
|            4      4   5                                                     |
|           r  => {c , c }                                                    |
|            5      4   6                                                     |
|                                                                             |
|o2 : Graph                                                                   |
+-----------------------------------------------------------------------------+

Ways to use tannerGraph:
========================

  * "tannerGraph(Matrix)"

For the programmer
==================

The object tannerGraph, is a method function (Macaulay2Doc).

randomCode -- constructs a random linear code over a finite field
*****************************************************************

Synopsis
========

  * Usage:
        randomCode(F,n,k)
        randomCode(QR,n,k)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * QR, a quotient ring (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),
      * k, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode,

Description
===========

Given a finite field F (or a quotient ring QR) and two positive integers n and
k, returns a random linear code over F (or QR) of length $n$ and dimension at
most $k$.

+-----------------------------------------------------------------------------+
|i1 : F = GF(2, 4)                                                            |
|                                                                             |
|o1 = F                                                                       |
|                                                                             |
|o1 : GaloisField                                                             |
+-----------------------------------------------------------------------------+
|i2 : C = randomCode(F,5,3)                                                   |
|                                                                             |
|                                  5                                          |
|o2 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                Code => image | a3+a2+1   a2+1   a3      |                   |
|                              | a3+1      a3+1   a3+a2+1 |                   |
|                              | a3+a2+a   0      a3+a2+a |                   |
|                              | a2+a      a2+a+1 a3+a+1  |                   |
|                              | a3+a2+a+1 1      a+1     |                   |
|                GeneratorMatrix => | a3+a2+1 a3+1    a3+a2+a a2+a   a3+a2+a+1|
|                                   | a2+1    a3+1    0       a2+a+1 1        |
|                                   | a3      a3+a2+1 a3+a2+a a3+a+1 a+1      |
|                                 3    2       3       3    2       2       3 |
|                Generators => {{a  + a  + 1, a  + 1, a  + a  + a, a  + a, a  |
|                ParityCheckMatrix => | 1 0 0    a3+a a2+a |                  |
|                                     | 0 1 a2+1 a+1  0    |                  |
|                                               3       2               2     |
|                ParityCheckRows => {{1, 0, 0, a  + a, a  + a}, {0, 1, a  + 1,|
|                                                                             |
|o2 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| |                                                                           |
| |                                                                           |
| |                                                                           |
|   2             2       3          2                3   3    2       3    2 |
|+ a  + a + 1}, {a  + 1, a  + 1, 0, a  + a + 1, 1}, {a , a  + a  + 1, a  + a  |
|                                                                             |
|                                                                             |
|                                                                             |
| a + 1, 0}}                                                                  |
|-----------------------------------------------------------------------------|
|                        }                                                    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|      3                                                                      |
|+ a, a  + a + 1, a + 1}}                                                     |
+-----------------------------------------------------------------------------+
|i3 : QR = ZZ/3                                                               |
|                                                                             |
|o3 = QR                                                                      |
|                                                                             |
|o3 : QuotientRing                                                            |
+-----------------------------------------------------------------------------+
|i4 : C = randomCode(QR,5,3)                                                  |
|                                                                             |
|                                   5                                         |
|o4 = LinearCode{AmbientModule => QR                                          |
|                BaseField => QR                                              |
|                cache => CacheTable{}                                        |
|                Code => image | 1  0  -1 |                                   |
|                              | 0  -1 1  |                                   |
|                              | -1 1  -1 |                                   |
|                              | 0  1  -1 |                                   |
|                              | 1  -1 -1 |                                   |
|                GeneratorMatrix => | 1  0  -1 0  1  |                        |
|                                   | 0  -1 1  1  -1 |                        |
|                                   | -1 1  -1 -1 -1 |                        |
|                Generators => {{1, 0, -1, 0, 1}, {0, -1, 1, 1, -1}, {-1, 1,  |
|                ParityCheckMatrix => | 1 0 -1 -1 1 |                         |
|                                     | 0 1 0  1  0 |                         |
|                ParityCheckRows => {{1, 0, -1, -1, 1}, {0, 1, 0, 1, 0}}      |
|                                                                             |
|o4 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|            }                                                                |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|-1, -1, -1}}                                                                 |
+-----------------------------------------------------------------------------+

Ways to use randomCode:
=======================

  * "randomCode(GaloisField,ZZ,ZZ)"
  * "randomCode(QuotientRing,ZZ,ZZ)"

For the programmer
==================

The object randomCode, is a method function (Macaulay2Doc).

repetitionCode -- repetition code
*********************************

Synopsis
========

  * Usage:
        repetitionCode(F,n)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode,

Description
===========

Returns the repetition code over F of length n.

+---------------------------+
|i1 : F = GF(2,3);          |
+---------------------------+
|i2 : n=7;                  |
+---------------------------+
|i3 : C=repetitionCode(F,n);|
+---------------------------+
|i4 : C.ParityCheckMatrix   |
|                           |
|o4 = | 1 1 0 0 0 0 0 |     |
|     | 1 0 1 0 0 0 0 |     |
|     | 1 0 0 1 0 0 0 |     |
|     | 1 0 0 0 1 0 0 |     |
|     | 1 0 0 0 0 1 0 |     |
|     | 1 0 0 0 0 0 1 |     |
|                           |
|             6      7      |
|o4 : Matrix F  <-- F       |
+---------------------------+

Ways to use repetitionCode:
===========================

  * "repetitionCode(GaloisField,ZZ)"

For the programmer
==================

The object repetitionCode, is a method function (Macaulay2Doc).

shorten -- shortens a code
**************************

Synopsis
========

  * Usage:
        shorten(LinearCode, List)
        shorten(LindearCode, ZZ)
  * Inputs:
      * C, an instance of the type LinearCode,
      * L, a list (Macaulay2Doc),
      * i, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode,

Description
===========

Given a code C of length $n$ and a list L (or an integer i), returns a new code
obtained from C by selecting only those codewords of C that have zeros in each
of the coordinate positions in the list L (or the position i), and then
deleting these positions.

The resulting code will have length $n - r$, where $r$ is the number of
elements in L (or 1 when the integer i is used).

a code and a list are given
===========================

  * Usage:
        shorten(LinearCode, List)
  * Inputs:
      * C, an instance of the type LinearCode,
      * L, a list (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode,

Given a code C of length $n$ and a list L, returns a new code obtained from C
by selecting only those codewords of C that have zeros in each of the
coordinate positions in the list L, and then deleting these positions.

The resulting code will have length $n - r$, where $r$ is the number of
elements in L.

+-----------------------------------------------------------------------------+
|i1 : F = GF(2);                                                              |
+-----------------------------------------------------------------------------+
|i2 : codeLen = 10;                                                           |
+-----------------------------------------------------------------------------+
|i3 : L = {{0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 1, 0,0}, {1, |
|-----------------------------------------------------------------------------|
|1, 0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 0, 1, 1,1}};                  |
+-----------------------------------------------------------------------------+
|i4 : C = linearCode(F,codeLen,L);                                            |
+-----------------------------------------------------------------------------+
|i5 : shorten(C, {3,6,8,9});                                                  |
+-----------------------------------------------------------------------------+

a linear code and an integer are given
======================================

  * Usage:
        shorten(LinearCode, ZZ)
  * Inputs:
      * C, an instance of the type LinearCode,
      * i, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Given a code C of length $n$ and a list L, returns a new code obtained from C
by selecting only those codewords of C that have zero in the position i), and
then deleting this position.

The resulting code will have length $n - 1$.

+-----------------------------------------------------------------------------+
|i6 : F = GF(2);                                                              |
+-----------------------------------------------------------------------------+
|i7 : codeLen = 10;                                                           |
+-----------------------------------------------------------------------------+
|i8 : L = {{0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 1, 0,0}, {1, |
|-----------------------------------------------------------------------------|
|1, 0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 0, 1, 1,1}};                  |
+-----------------------------------------------------------------------------+
|i9 : C = linearCode(F,codeLen,L);                                            |
+-----------------------------------------------------------------------------+
|i10 : shorten(C, 3)                                                          |
|                                                                             |
|                                   9                                         |
|o10 = LinearCode{AmbientModule => F                                          |
|                 BaseField => F                                              |
|                 cache => CacheTable{}                                       |
|                 Code => image | 0 1 1 1 0 0 1 0 |                           |
|                               | 1 1 1 0 0 0 0 1 |                           |
|                               | 0 0 1 1 1 0 0 1 |                           |
|                               | 0 0 1 1 1 0 0 1 |                           |
|                               | 0 1 0 0 1 0 1 1 |                           |
|                               | 0 0 0 0 0 0 0 0 |                           |
|                               | 0 0 1 1 1 0 0 1 |                           |
|                               | 0 1 1 1 0 0 1 0 |                           |
|                               | 0 0 0 0 0 0 0 0 |                           |
|                 GeneratorMatrix => | 0 1 0 0 0 0 0 0 0 |                    |
|                                    | 1 1 0 0 1 0 0 1 0 |                    |
|                                    | 1 1 1 1 0 0 1 1 0 |                    |
|                                    | 1 0 1 1 0 0 1 1 0 |                    |
|                                    | 0 0 1 1 1 0 1 0 0 |                    |
|                                    | 0 0 0 0 0 0 0 0 0 |                    |
|                                    | 1 0 0 0 1 0 0 1 0 |                    |
|                                    | 0 1 1 1 1 0 1 0 0 |                    |
|                 Generators => {{0, 1, 0, 0, 0, 0, 0, 0, 0}, {1, 1, 0, 0, 1, |
|                 ParityCheckMatrix => | 0 0 1 1 0 0 0 0 0 |                  |
|                                      | 1 0 1 0 1 0 0 0 0 |                  |
|                                      | 0 0 0 0 0 1 0 0 0 |                  |
|                                      | 0 0 1 0 0 0 1 0 0 |                  |
|                                      | 1 0 0 0 0 0 0 1 0 |                  |
|                                      | 0 0 0 0 0 0 0 0 1 |                  |
|                 ParityCheckRows => {{0, 0, 1, 1, 0, 0, 0, 0, 0}, {1, 0, 1, 0|
|                                                                             |
|o10 : LinearCode                                                             |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0, 0, 1, 0}, {1, 1, 1, 1, 0, 0, 1, 1, 0}, {1, 0, 1, 1, 0, 0, 1, 1, 0}, {0, 0,|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 1, 0, 0}, {|
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 1, 1, 1, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 1, |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1}}                     |
|-----------------------------------------------------------------------------|
|                                }                                            |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {0, 1, 1, 1, 1, 0, 1, 0, 0}}                                             |
+-----------------------------------------------------------------------------+

Ways to use shorten:
====================

  * "shorten(LinearCode,List)"
  * "shorten(LinearCode,ZZ)"

For the programmer
==================

The object shorten, is a method function (Macaulay2Doc).

universeCode -- linear code $\mathtt{F}^\mathtt{n}$
***************************************************

Synopsis
========

  * Usage:
        universeCode(F,n)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode,

Description
===========

Returns the code with largest dimension such that its length is n and the
entries of its codewords are in the field F.

+-----------------------------------------------------------------------------+
|i1 : F = GF(2,3);                                                            |
+-----------------------------------------------------------------------------+
|i2 : n=7;                                                                    |
+-----------------------------------------------------------------------------+
|i3 : C=universeCode(F,n)                                                     |
|                                                                             |
|                                  7                                          |
|o3 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                GeneratorMatrix => | 1 0 0 0 0 0 0 |                         |
|                                   | 0 1 0 0 0 0 0 |                         |
|                                   | 0 0 1 0 0 0 0 |                         |
|                                   | 0 0 0 1 0 0 0 |                         |
|                                   | 0 0 0 0 1 0 0 |                         |
|                                   | 0 0 0 0 0 1 0 |                         |
|                                   | 0 0 0 0 0 0 1 |                         |
|                Generators => {{1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0}, |
|                ParityCheckMatrix => 0                                       |
|                ParityCheckRows => {{}}                                      |
|                                                                             |
|o3 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0}, {0, 0,  |
|-----------------------------------------------------------------------------|
|                                      }                                      |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 0, 1}}                                       |
+-----------------------------------------------------------------------------+
|i4 : C.ParityCheckMatrix                                                     |
|                                                                             |
|o4 = 0                                                                       |
|                                                                             |
|              1       7                                                      |
|o4 : Matrix ZZ  <-- ZZ                                                       |
+-----------------------------------------------------------------------------+

Ways to use universeCode:
=========================

  * "universeCode(GaloisField,ZZ)"

For the programmer
==================

The object universeCode, is a method function (Macaulay2Doc).

zeroCode -- zero code
*********************

Synopsis
========

  * Usage:
        zeroCode(F,n)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode,

Description
===========

Constructs the linear code of length n over F whose only codeword is the zero
codeword.

+-----------------------------------------------------------------------------+
|i1 : C=zeroCode(GF(4),7)                                                     |
|                                                                             |
|                                       7                                     |
|o1 = LinearCode{AmbientModule => (GF 4)                                      |
|                BaseField => GF 4                                            |
|                cache => CacheTable{}                                        |
|                GeneratorMatrix => 0                                         |
|                Generators => {{}}                                           |
|                ParityCheckMatrix => | 1 0 0 0 0 0 0 |                       |
|                                     | 0 1 0 0 0 0 0 |                       |
|                                     | 0 0 1 0 0 0 0 |                       |
|                                     | 0 0 0 1 0 0 0 |                       |
|                                     | 0 0 0 0 1 0 0 |                       |
|                                     | 0 0 0 0 0 1 0 |                       |
|                                     | 0 0 0 0 0 0 1 |                       |
|                ParityCheckRows => {{1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0,|
|                                                                             |
|o1 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0}, {0, |
|-----------------------------------------------------------------------------|
|                                         }                                   |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 0, 1}}                                    |
+-----------------------------------------------------------------------------+
|i2 : C.GeneratorMatrix                                                       |
|                                                                             |
|o2 = 0                                                                       |
|                                                                             |
|              1       7                                                      |
|o2 : Matrix ZZ  <-- ZZ                                                       |
+-----------------------------------------------------------------------------+

Ways to use zeroCode:
=====================

  * "zeroCode(GaloisField,ZZ)"

For the programmer
==================

The object zeroCode, is a method function (Macaulay2Doc).

zeroSumCode -- linear code in which the entries of each codeword add up zero
****************************************************************************

Synopsis
========

  * Usage:
        zeroSumCode(F,n)
  * Inputs:
      * F, a Galois field (Macaulay2Doc),
      * n, an integer (Macaulay2Doc),
  * Outputs:
      * an instance of the type LinearCode, $C$

Description
===========

Returns the code $C$ of length n over F such that for any $c\in C$,
$\sum_{i=1}^n c_i=0$. The dual of the code $C$ is the repetition code. In the
binary case, this code $C$ equals the code of all even-weight codewords.

+-----------------------------------------------------------------------------+
|i1 : D = zeroSumCode(GF 3,5)                                                 |
|                                                                             |
|                                       5                                     |
|o1 = LinearCode{AmbientModule => (GF 3)                                      |
|                BaseField => GF 3                                            |
|                cache => CacheTable{}                                        |
|                Code => image | -1 -1 -1 -1 |                                |
|                              | 1  0  0  0  |                                |
|                              | 0  1  0  0  |                                |
|                              | 0  0  1  0  |                                |
|                              | 0  0  0  1  |                                |
|                GeneratorMatrix => | -1 1 0 0 0 |                            |
|                                   | -1 0 1 0 0 |                            |
|                                   | -1 0 0 1 0 |                            |
|                                   | -1 0 0 0 1 |                            |
|                Generators => {{-1, 1, 0, 0, 0}, {-1, 0, 1, 0, 0}, {-1, 0, 0,|
|                ParityCheckMatrix => | 1 1 1 1 1 |                           |
|                ParityCheckRows => {{1, 1, 1, 1, 1}}                         |
|                                                                             |
|o1 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                        }                                                    |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|1, 0}, {-1, 0, 0, 0, 1}}                                                     |
+-----------------------------------------------------------------------------+
+-----------------------------------------------------------------------------+
|i2 : E = zeroSumCode(GF 8,5)                                                 |
|                                                                             |
|                                       5                                     |
|o2 = LinearCode{AmbientModule => (GF 8)                                      |
|                BaseField => GF 8                                            |
|                cache => CacheTable{}                                        |
|                Code => image | 1 1 1 1 |                                    |
|                              | 1 0 0 0 |                                    |
|                              | 0 1 0 0 |                                    |
|                              | 0 0 1 0 |                                    |
|                              | 0 0 0 1 |                                    |
|                GeneratorMatrix => | 1 1 0 0 0 |                             |
|                                   | 1 0 1 0 0 |                             |
|                                   | 1 0 0 1 0 |                             |
|                                   | 1 0 0 0 1 |                             |
|                Generators => {{1, 1, 0, 0, 0}, {1, 0, 1, 0, 0}, {1, 0, 0, 1,|
|                ParityCheckMatrix => | 1 1 1 1 1 |                           |
|                ParityCheckRows => {{1, 1, 1, 1, 1}}                         |
|                                                                             |
|o2 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                    }                                                        |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0}, {1, 0, 0, 0, 1}}                                                         |
+-----------------------------------------------------------------------------+

Ways to use zeroSumCode:
========================

  * "zeroSumCode(GaloisField,ZZ)"

For the programmer
==================

The object zeroSumCode, is a method function (Macaulay2Doc).

messages -- set of messages to be encoded by a code
***************************************************

Synopsis
========

  * Usage:
        messages C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

Given a code C of dimension $k$ over a finite field $F$, this function returns
the list that contains all the elements of $F^k$. Every element of the list can
be used to encode a message using the linear code C.

+-------------------------------+
|i1 : F=GF(4,Variable=>a);      |
+-------------------------------+
|i2 : R=linearCode(F,{{1,1,1}});|
+-------------------------------+
|i3 : messages R                |
|                               |
|o3 = {{1}, {a}, {a + 1}, {0}}  |
|                               |
|o3 : List                      |
+-------------------------------+
+-----------------------------------------------------------------------------+
|i4 : messages hammingCode(2,3)                                               |
|                                                                             |
|o4 = {{1, 0, 0, 0}, {1, 0, 0, 1}, {1, 0, 1, 0}, {1, 0, 1, 1}, {1, 1, 1, 0},  |
|     ------------------------------------------------------------------------|
|     {1, 1, 1, 1}, {0, 1, 1, 0}, {0, 1, 0, 1}, {0, 1, 0, 0}, {0, 1, 1, 1},   |
|     ------------------------------------------------------------------------|
|     {0, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 1, 1}, {0, 0, 1, 0}, {1, 1, 0, 1},   |
|     ------------------------------------------------------------------------|
|     {1, 1, 0, 0}}                                                           |
|                                                                             |
|o4 : List                                                                    |
+-----------------------------------------------------------------------------+
+-----------------------------------------------------------------------------+
|i5 : RM=reedMullerCode(2,2,1);                                               |
+-----------------------------------------------------------------------------+
|i6 : messages(RM.LinearCode)                                                 |
|                                                                             |
|o6 = {{0, 1, 0}, {0, 1, 1}, {1, 1, 1}, {0, 0, 0}, {0, 0, 1}, {1, 1, 0}, {1,  |
|     ------------------------------------------------------------------------|
|     0, 1}, {1, 0, 0}}                                                       |
|                                                                             |
|o6 : List                                                                    |
+-----------------------------------------------------------------------------+

This method is provided by the package CodingTheory.

See also
========

  * codewords -- codewords of the code

Ways to use messages:
=====================

  * "messages(LinearCode)"

For the programmer
==================

The object messages, is a method function (Macaulay2Doc).

weight -- Hamming weight of a list
**********************************

Synopsis
========

  * Usage:
        weight(L)
  * Inputs:
      * L, a list (Macaulay2Doc),
  * Outputs:
      * an integer (Macaulay2Doc),

Description
===========

Computes the Hamming weight of a list L, which is the number of its non-zero
entries.

+------------------------+
|i1 : weight({1,0,1,0,1})|
|                        |
|o1 = 3                  |
+------------------------+
+-----------------------------+
|i2 : weight({0,123,48,0,256})|
|                             |
|o2 = 3                       |
+-----------------------------+

Ways to use weight:
===================

  * "weight(BasicList)"

For the programmer
==================

The object weight, is a method function (Macaulay2Doc).

Related functions

minimumWeight -- computes the minimum weight of a linear code
*************************************************************

Synopsis
========

  * Usage:
        minimumWeight C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Optional inputs (Macaulay2Doc),:
      * Strat, => ..., default value "", Specify the algorithm
        used to perform a minimum weight computation.
  * Outputs:
      * an integer (Macaulay2Doc),

Description
===========

The minimum weight of a linear code $C$ is the minimum Hamming weight of its
non-zero codewords. It is known that computing the minimum weight of a linear
code is an NP-hard problem.

If no value is specified for the optional argument Strat is specified, the
function chooseStrat, is used internally to choose a
strategy. Usually it is best not to specify a value of the optional strategy
argument, because a strategy is automatically chosen based on built-in
approximations of performance.

+------------------------------------------+
|i1 : C=hammingCode(2,3);                  |
+------------------------------------------+
|i2 : minimumWeight C                      |
|                                          |
|o2 = 3                                    |
+------------------------------------------+
|i3 : minimumWeight(C, Strat=>"BruteForce")|
|                                          |
|o3 = 3                                    |
+------------------------------------------+

See also
========

  * weight -- Hamming weight of a list

Ways to use minimumWeight:
==========================

  * "minimumWeight(LinearCode)"

For the programmer
==================

The object minimumWeight, is a method function with options (Macaulay2Doc).

Related functions

chooseStrat -- Estimate the optimal strategy to compute the minimum weight of a linear code.
********************************************************************************************

Synopsis
========

  * Usage:
        chooseStrat C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a string (Macaulay2Doc),

Description
===========

This function returns the name of the strategy that would be automatically
chosen by function minimumWeight, if no value of the
optional argument Strat is specified.

+----------------------------------------------+
|i1 : chooseStrat(hammingCode(2,3))            |
|                                              |
|o1 = OneInfoSet                               |
+----------------------------------------------+
|i2 : F = GF(16);                              |
+----------------------------------------------+
|i3 : chooseStrat(linearCode random(F^5, F^10))|
|                                              |
|o3 = MatroidPartition                         |
+----------------------------------------------+

See also
========

  * minimumWeight(...,Strat=>...) -- Specify the algorithm used
    to perform a minimum weight computation.

Ways to use chooseStrat:
========================

  * "chooseStrat(LinearCode)"

For the programmer
==================

The object chooseStrat, is a method function (Macaulay2Doc).

Strat -- Specify the algorithm used to perform a minimum weight computation.
****************************************************************************

Synopsis
========

  * Usage:
        minimumWeight(C, Strat=>StratName)
  * Inputs:
      * C, an instance of the type LinearCode,
      * StratName, a string (Macaulay2Doc),

Description
===========

StratName is the name of the desired algorithm to use. By default, the function
minimumWeight, uses the function chooseStrat,
to estimate the optimal strategy for a given linear code.
Specifying a strategy manually is not recommended in the majority of cases
because chooseStrat, reliably chooses the best strategy
based on approximations of performance.

The valid options of the argument StratName are:

  * MatroidPartition: The most advanced algorithm, but requires a longer
    up-front computation.
  * OneInfoSet: An algorithm that is always faster than BruteForce.
  * BruteForce: (Not recommended) Determine the minimum weight by enumerating
    all codewords.

MatroidPartition is the most advanced strategy, but requires a longer up-front
computation. Specifically, it has to compute the matroid associated with the
given linear code's generator matrix and then compute a partition of it into
independent sets. If such a partition exists, this algorithm will be strictly
faster than OneInfoSet after the matroid partition has been computed.

OneInfoSet can be viewed as a direct improvement over the BruteForce strategy.
The properties of this algorithm imply that it is always as fast or faster than
BruteForce.

BruteForce is the simplest and most reliable strategy, but also almost always
the slowest. It is intended mainly for internal purposes such as debugging and
testing the other strategies.

+------------------------------------------+
|i1 : C=hammingCode(2,3);                  |
+------------------------------------------+
|i2 : minimumWeight(C, Strat=>"BruteForce")|
|                                          |
|o2 = 3                                    |
+------------------------------------------+

See also
========

  * chooseStrat -- Estimate the optimal strategy to compute
    the minimum weight of a linear code.

Functions with optional argument named Strat:
=============================================

  * "minimumWeight(...,Strat=>...)"

For the programmer
==================

The object Strat, is a symbol (Macaulay2Doc).

syndromeDecode -- syndrome decoding on a code
*********************************************

Synopsis
========

  * Usage:
        syndromeDecode(C,v,minDist)
  * Inputs:
      * C, an instance of the type LinearCode,
      * v, a matrix (Macaulay2Doc),
      * minDist, an integer (Macaulay2Doc),
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

When this function runs, it checks the cache of the LinearCode C for an
existing syndrome look-up table. If a look-up table is not found, it
automatically generates one. Because of this, the first time this function is
called will take longer than subsequent calls. If you want to access the
look-up table, it can be obtained from C.cache#"syndromeLUT". The minDist
argument only affects the behavior of this function on the first call, because
it is only used when generating the syndrome look-up table.

+---------------------------------------------------------+
|i1 : C = hammingCode(2,3);                               |
+---------------------------------------------------------+
|i2 : msg = matrix {{1,0,1,0}};                           |
|                                                         |
|              1       4                                  |
|o2 : Matrix ZZ  <-- ZZ                                   |
+---------------------------------------------------------+
|i3 : v = msg*(C.GeneratorMatrix);                        |
|                                                         |
|                  1           7                          |
|o3 : Matrix (GF 2)  <-- (GF 2)                           |
+---------------------------------------------------------+
|i4 : err = matrix take(random entries basis source v, 1);|
|                                                         |
|                  1           7                          |
|o4 : Matrix (GF 2)  <-- (GF 2)                           |
+---------------------------------------------------------+
|i5 : received = (transpose (v+err));                     |
|                                                         |
|                  7           1                          |
|o5 : Matrix (GF 2)  <-- (GF 2)                           |
+---------------------------------------------------------+
|i6 : syndromeDecode(C, received, 3);                     |
|                                                         |
|                  7           1                          |
|o6 : Matrix (GF 2)  <-- (GF 2)                           |
+---------------------------------------------------------+
|i7 : C.cache#"syndromeLUT"                               |
|                                                         |
|o7 = HashTable{0 => 0        }                           |
|               | 0 | => | 0 |                            |
|               | 0 |    | 0 |                            |
|               | 1 |    | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 1 |                            |
|               | 0 | => | 0 |                            |
|               | 1 |    | 0 |                            |
|               | 0 |    | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 1 |                            |
|                        | 0 |                            |
|               | 0 | => | 0 |                            |
|               | 1 |    | 0 |                            |
|               | 1 |    | 0 |                            |
|                        | 0 |                            |
|                        | 1 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|               | 1 | => | 1 |                            |
|               | 0 |    | 0 |                            |
|               | 0 |    | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|               | 1 | => | 0 |                            |
|               | 0 |    | 1 |                            |
|               | 1 |    | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|               | 1 | => | 0 |                            |
|               | 1 |    | 0 |                            |
|               | 0 |    | 1 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|               | 1 | => | 0 |                            |
|               | 1 |    | 0 |                            |
|               | 1 |    | 0 |                            |
|                        | 1 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                        | 0 |                            |
|                                                         |
|o7 : HashTable                                           |
+---------------------------------------------------------+

Ways to use syndromeDecode:
===========================

  * "syndromeDecode(LinearCode,Matrix,ZZ)"

For the programmer
==================

The object syndromeDecode, is a method function (Macaulay2Doc).

LinearCode == LinearCode -- determines if two linear codes are equal
********************************************************************

Synopsis
========

  * Operator: == (Macaulay2Doc),
  * Usage:
        LinearCode == LinearCode
  * Inputs:
      * C1, an instance of the type LinearCode,
      * C2, an instance of the type LinearCode,
  * Outputs:
      * a Boolean value (Macaulay2Doc),

Description
===========

Given linear codes C1 and C2, this function determines if they define the same
subspace over the same field or ring.

+-----------------------------------------------------------------------------+
|i1 : F = GF(3,4)                                                             |
|                                                                             |
|o1 = F                                                                       |
|                                                                             |
|o1 : GaloisField                                                             |
+-----------------------------------------------------------------------------+
|i2 : codeLen = 7; codeDim = 3;                                               |
+-----------------------------------------------------------------------------+
|i4 : L = apply(toList(1..codeDim),j-> apply(toList(1..codeLen),i-> random(F))|
|                                                                             |
|          3       2   3             3    2           3    2         3    2   |
|o4 = {{- a  + a, a , a  + a + 1, - a  - a  - a - 1, a  - a  - a, - a  - a  + |
|     ------------------------------------------------------------------------|
|               3    2         3    2           3    2           2       2    |
|     a - 1, - a  - a  - 1}, {a  - a  + a + 1, a  - a  + a - 1, a  - a, a  -  |
|     ------------------------------------------------------------------------|
|           3    2             3    2           3    2             3       2  |
|     1, - a  + a  + a - 1, - a  - a  + a - 1, a  - a  - a - 1}, {a  - 1, a  -|
|     ------------------------------------------------------------------------|
|         2       3    2           2          3    2                          |
|     a, a  + a, a  + a  - a - 1, a  - 1, a, a  + a  - a - 1}}                |
|                                                                             |
|o4 : List                                                                    |
|-----------------------------------------------------------------------------|
|)                                                                            |
+-----------------------------------------------------------------------------+
|i5 : C1 = linearCode(F,L)                                                    |
|                                                                             |
|                                  7                                          |
|o5 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                Code => image | -a3+a      a3-a2+a+1  a3-1      |            |
|                              | a2         a3-a2+a-1  a2-a      |            |
|                              | a3+a+1     a2-a       a2+a      |            |
|                              | -a3-a2-a-1 a2-1       a3+a2-a-1 |            |
|                              | a3-a2-a    -a3+a2+a-1 a2-1      |            |
|                              | -a3-a2+a-1 -a3-a2+a-1 a         |            |
|                              | -a3-a2-1   a3-a2-a-1  a3+a2-a-1 |            |
|                GeneratorMatrix => | -a3+a     a2        a3+a+1 -a3-a2-a-1   |
|                                   | a3-a2+a+1 a3-a2+a-1 a2-a   a2-1         |
|                                   | a3-1      a2-a      a2+a   a3+a2-a-1    |
|                                   3       2   3             3    2          |
|                Generators => {{- a  + a, a , a  + a + 1, - a  - a  - a - 1  |
|                ParityCheckMatrix => | 1 0 0 0 a3-a2      a3+a2-a-1  a3+a2   |
|                                     | 0 1 0 0 -a2-1      a3-a2+a-1  1       |
|                                     | 0 0 1 0 a3+a2+a+1  -a3+a2-a+1 a3+a2+  |
|                                     | 0 0 0 1 -a3+a2+a-1 a3-a       a3-a2-  |
|                                                  3    2   3    2            |
|                ParityCheckRows => {{1, 0, 0, 0, a  - a , a  + a  - a - 1,   |
|                                                                             |
|o5 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|a3-a2-a    -a3-a2+a-1 -a3-a2-1  |                                            |
|-a3+a2+a-1 -a3-a2+a-1 a3-a2-a-1 |                                            |
|a2-1       a          a3+a2-a-1 |                                            |
|   3    2         3    2             3    2         3    2                   |
|, a  - a  - a, - a  - a  + a - 1, - a  - a  - 1}, {a  - a  +                 |
|    |                                                                        |
|    |                                                                        |
|a+1 |                                                                        |
|a-1 |                                                                        |
| 3    2                   2       3    2                                     |
|a  + a }, {0, 1, 0, 0, - a  - 1, a  - a  + a - 1, 1}, {0, 0,                 |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|        3    2           2       2         3    2             3    2         |
|a + 1, a  - a  + a - 1, a  - a, a  - 1, - a  + a  + a - 1, - a  - a  + a - 1,|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|       3    2             3    2           3    2                           3|
|1, 0, a  + a  + a + 1, - a  + a  - a + 1, a  + a  + a + 1}, {0, 0, 0, 1, - a |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 3    2             3       2       2       3    2           2          3    |
|a  - a  - a - 1}, {a  - 1, a  - a, a  + a, a  + a  - a - 1, a  - 1, a, a  +  |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|   2           3       3    2                                                |
|+ a  + a - 1, a  - a, a  - a  - a - 1}}                                      |
|-----------------------------------------------------------------------------|
|            }                                                                |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 2                                                                           |
|a  - a - 1}}                                                                 |
+-----------------------------------------------------------------------------+
|i6 : C2 = linearCode(matrix L)                                               |
|                                                                             |
|                                  7                                          |
|o6 = LinearCode{AmbientModule => F                                           |
|                BaseField => F                                               |
|                cache => CacheTable{}                                        |
|                Code => image | -a3+a      a3-a2+a+1  a3-1      |            |
|                              | a2         a3-a2+a-1  a2-a      |            |
|                              | a3+a+1     a2-a       a2+a      |            |
|                              | -a3-a2-a-1 a2-1       a3+a2-a-1 |            |
|                              | a3-a2-a    -a3+a2+a-1 a2-1      |            |
|                              | -a3-a2+a-1 -a3-a2+a-1 a         |            |
|                              | -a3-a2-1   a3-a2-a-1  a3+a2-a-1 |            |
|                GeneratorMatrix => | -a3+a     a2        a3+a+1 -a3-a2-a-1   |
|                                   | a3-a2+a+1 a3-a2+a-1 a2-a   a2-1         |
|                                   | a3-1      a2-a      a2+a   a3+a2-a-1    |
|                                   3       2   3             3    2          |
|                Generators => {{- a  + a, a , a  + a + 1, - a  - a  - a - 1  |
|                ParityCheckMatrix => | 1 0 0 0 a3-a2      a3+a2-a-1  a3+a2   |
|                                     | 0 1 0 0 -a2-1      a3-a2+a-1  1       |
|                                     | 0 0 1 0 a3+a2+a+1  -a3+a2-a+1 a3+a2+  |
|                                     | 0 0 0 1 -a3+a2+a-1 a3-a       a3-a2-  |
|                                                  3    2   3    2            |
|                ParityCheckRows => {{1, 0, 0, 0, a  - a , a  + a  - a - 1,   |
|                                                                             |
|o6 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|a3-a2-a    -a3-a2+a-1 -a3-a2-1  |                                            |
|-a3+a2+a-1 -a3-a2+a-1 a3-a2-a-1 |                                            |
|a2-1       a          a3+a2-a-1 |                                            |
|   3    2         3    2             3    2         3    2                   |
|, a  - a  - a, - a  - a  + a - 1, - a  - a  - 1}, {a  - a  +                 |
|    |                                                                        |
|    |                                                                        |
|a+1 |                                                                        |
|a-1 |                                                                        |
| 3    2                   2       3    2                                     |
|a  + a }, {0, 1, 0, 0, - a  - 1, a  - a  + a - 1, 1}, {0, 0,                 |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|        3    2           2       2         3    2             3    2         |
|a + 1, a  - a  + a - 1, a  - a, a  - 1, - a  + a  + a - 1, - a  - a  + a - 1,|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|       3    2             3    2           3    2                           3|
|1, 0, a  + a  + a + 1, - a  + a  - a + 1, a  + a  + a + 1}, {0, 0, 0, 1, - a |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 3    2             3       2       2       3    2           2          3    |
|a  - a  - a - 1}, {a  - 1, a  - a, a  + a, a  + a  - a - 1, a  - 1, a, a  +  |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|   2           3       3    2                                                |
|+ a  + a - 1, a  - a, a  - a  - a - 1}}                                      |
|-----------------------------------------------------------------------------|
|            }                                                                |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 2                                                                           |
|a  - a - 1}}                                                                 |
+-----------------------------------------------------------------------------+
|i7 : C1 == C2                                                                |
|                                                                             |
|o7 = true                                                                    |
+-----------------------------------------------------------------------------+

Ways to use this method:
========================

  * LinearCode == LinearCode -- determines if
    two linear codes are equal

dim(LinearCode) -- dimension of a linear code
*********************************************

Synopsis
========

  * Function: dim (Macaulay2Doc),
  * Usage:
        dim C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a number (Macaulay2Doc),

Description
===========

Given a linear code C, returns the dimension of C. The dimension of C is
defined as the dimension of C as a vector space.

+-----------------------------------------------------------------------------+
|i1 : C = linearCode(GF(2),{{1,1,0,0},{0,0,1,1}});                            |
+-----------------------------------------------------------------------------+
|i2 : dim C                                                                   |
|                                                                             |
|o2 = 2                                                                       |
+-----------------------------------------------------------------------------+
|i3 : H = hammingCode(2,3)                                                    |
|                                                                             |
|                                       7                                     |
|o3 = LinearCode{AmbientModule => (GF 2)                                      |
|                BaseField => GF 2                                            |
|                cache => CacheTable{}                                        |
|                Code => image | 1 0 1 1 |                                    |
|                              | 1 1 1 0 |                                    |
|                              | 1 1 0 1 |                                    |
|                              | 1 0 0 0 |                                    |
|                              | 0 1 0 0 |                                    |
|                              | 0 0 1 0 |                                    |
|                              | 0 0 0 1 |                                    |
|                GeneratorMatrix => | 1 1 1 1 0 0 0 |                         |
|                                   | 0 1 1 0 1 0 0 |                         |
|                                   | 1 1 0 0 0 1 0 |                         |
|                                   | 1 0 1 0 0 0 1 |                         |
|                Generators => {{1, 1, 1, 1, 0, 0, 0}, {0, 1, 1, 0, 1, 0, 0}, |
|                ParityCheckMatrix => | 1 1 1 1 0 0 0 |                       |
|                                     | 0 1 0 1 1 1 0 |                       |
|                                     | 0 1 1 0 0 1 1 |                       |
|                ParityCheckRows => {{1, 1, 1, 1, 0, 0, 0}, {0, 1, 0, 1, 1, 1,|
|                                                                             |
|o3 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                             }                               |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{1, 1, 0, 0, 0, 1, 0}, {1, 0, 1, 0, 0, 0, 1}}                                |
|                                                                             |
|                                                                             |
|                                                                             |
| 0}, {0, 1, 1, 0, 0, 1, 1}}                                                  |
+-----------------------------------------------------------------------------+
|i4 : dim H                                                                   |
|                                                                             |
|o4 = 4                                                                       |
+-----------------------------------------------------------------------------+

Ways to use this method:
========================

  * dim(LinearCode) -- dimension of a linear code

length(LinearCode) -- returns the length of a linear code
*********************************************************

Synopsis
========

  * Function: length (Macaulay2Doc),
  * Usage:
        length C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * an integer (Macaulay2Doc),

Description
===========

Given a linear code C over a Galois field, returns the number of entries in any
codeword in C. This parameter is called the length of the code.

This method is provided by the package CodingTheory.

+---------------------------------------+
|i1 : C = linearCode(GF(4),{{1,1,1,1}});|
+---------------------------------------+
|i2 : length C                          |
|                                       |
|o2 = 4                                 |
+---------------------------------------+
|i3 : H = hammingCode(2,3);             |
+---------------------------------------+
|i4 : length H                          |
|                                       |
|o4 = 7                                 |
+---------------------------------------+

The next example illustrates how to use this function for the class of
Evaluation Codes.

+--------------------------------+
|i5 : RM = reedMullerCode(2,3,1);|
+--------------------------------+
|i6 : length RM.LinearCode       |
|                                |
|o6 = 8                          |
+--------------------------------+

Ways to use this method:
========================

  * length(LinearCode) -- returns the length of
    a linear code

ring(LinearCode) -- the ring of a code
**************************************

Synopsis
========

  * Function: ring (Macaulay2Doc),
  * Usage:
        ring LinearCode
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a ring (Macaulay2Doc),

Description
===========

Given a code C, returns the ring that contains the entries of the generator
matrix of C.

+-----------------------------------------------------------------------------+
|i1 : C = hammingCode(2, 3)                                                   |
|                                                                             |
|                                       7                                     |
|o1 = LinearCode{AmbientModule => (GF 2)                                      |
|                BaseField => GF 2                                            |
|                cache => CacheTable{}                                        |
|                Code => image | 1 0 1 1 |                                    |
|                              | 1 1 0 1 |                                    |
|                              | 1 1 1 0 |                                    |
|                              | 1 0 0 0 |                                    |
|                              | 0 1 0 0 |                                    |
|                              | 0 0 1 0 |                                    |
|                              | 0 0 0 1 |                                    |
|                GeneratorMatrix => | 1 1 1 1 0 0 0 |                         |
|                                   | 0 1 1 0 1 0 0 |                         |
|                                   | 1 0 1 0 0 1 0 |                         |
|                                   | 1 1 0 0 0 0 1 |                         |
|                Generators => {{1, 1, 1, 1, 0, 0, 0}, {0, 1, 1, 0, 1, 0, 0}, |
|                ParityCheckMatrix => | 1 1 1 1 0 0 0 |                       |
|                                     | 0 0 1 1 1 1 0 |                       |
|                                     | 0 1 0 1 1 0 1 |                       |
|                ParityCheckRows => {{1, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 1, 1, 1,|
|                                                                             |
|o1 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                             }                               |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|{1, 0, 1, 0, 0, 1, 0}, {1, 1, 0, 0, 0, 0, 1}}                                |
|                                                                             |
|                                                                             |
|                                                                             |
| 0}, {0, 1, 0, 1, 1, 0, 1}}                                                  |
+-----------------------------------------------------------------------------+
|i2 : ring(C)                                                                 |
|                                                                             |
|o2 = GF 2                                                                    |
|                                                                             |
|o2 : GaloisField                                                             |
+-----------------------------------------------------------------------------+

Ways to use this method:
========================

  * ring(LinearCode) -- the ring of a code

size(LinearCode) -- gives the number of codewords in a linear code
******************************************************************

Synopsis
========

  * Function: size (Macaulay2Doc),
  * Usage:
        size C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * an integer (Macaulay2Doc),

Description
===========

Given a linear code C of dimension $k$ over a Galois field with $q$ elements,
returns the number of codewords in C, which is $q^k$.

This method is provided by the package CodingTheory.

+-------------------------------------------------+
|i1 : C = linearCode(GF(4),{{1,1,1,1}});          |
+-------------------------------------------------+
|i2 : size C                                      |
|                                                 |
|o2 = 4                                           |
+-------------------------------------------------+
|i3 : H = hammingCode(2,3);                       |
+-------------------------------------------------+
|i4 : size H                                      |
|                                                 |
|o4 = 16                                          |
+-------------------------------------------------+
|i5 : F = GF(4,Variable=>a);                      |
+-------------------------------------------------+
|i6 : L = {{1,a,a+1},{a+1,1,a},{a,a+1,1},{1,0,1}};|
+-------------------------------------------------+
|i7 : C = linearCode(F,L);                        |
+-------------------------------------------------+
|i8 : size C                                      |
|                                                 |
|o8 = 16                                          |
+-------------------------------------------------+

The next example illustrates how to use this function for the class of
Evaluation Codes.

+--------------------------------+
|i9 : RM = reedMullerCode(2,3,1);|
+--------------------------------+
|i10 : size RM.LinearCode        |
|                                |
|o10 = 16                        |
+--------------------------------+

Ways to use this method:
========================

  * size(LinearCode) -- gives the number of
    codewords in a linear code

toString(LinearCode) -- string with the vectors of a generator matrix of a code
*******************************************************************************

Synopsis
========

  * Function: toString (Macaulay2Doc),
  * Usage:
        toString C
  * Inputs:
      * C, an instance of the type LinearCode,
  * Outputs:
      * a string (Macaulay2Doc),

Description
===========

Given a linear code C, this function returns a string that contains the rows of
a generator matrix of C.

+-----------------------------------------------------------------------------+
|i1 : L = {{0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 1, 0,1, 0, 0}, {1, |
|                                                                             |
|o1 = {{0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 1, 0, 0}, {1, 1, |
|     ------------------------------------------------------------------------|
|     0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 0, 1, 1, 1}}                |
|                                                                             |
|o1 : List                                                                    |
|-----------------------------------------------------------------------------|
|1, 0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 0, 1, 1, 1}}                  |
+-----------------------------------------------------------------------------+
|i2 : C = linearCode(GF(2),L)                                                 |
|                                                                             |
|                                       10                                    |
|o2 = LinearCode{AmbientModule => (GF 2)                                      |
|                BaseField => GF 2                                            |
|                cache => CacheTable{}                                        |
|                Code => image | 0 0 1 1 |                                    |
|                              | 1 0 1 0 |                                    |
|                              | 0 1 0 0 |                                    |
|                              | 0 0 0 1 |                                    |
|                              | 0 1 0 0 |                                    |
|                              | 0 1 1 0 |                                    |
|                              | 0 0 0 0 |                                    |
|                              | 0 1 0 1 |                                    |
|                              | 0 0 1 1 |                                    |
|                              | 0 0 0 1 |                                    |
|                GeneratorMatrix => | 0 1 0 0 0 0 0 0 0 0 |                   |
|                                   | 0 0 1 0 1 1 0 1 0 0 |                   |
|                                   | 1 1 0 0 0 1 0 0 1 0 |                   |
|                                   | 1 0 0 1 0 0 0 1 1 1 |                   |
|                Generators => {{0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1|
|                ParityCheckMatrix => | 0 0 1 1 0 0 0 1 0 0 |                 |
|                                     | 0 0 0 1 1 0 0 1 0 0 |                 |
|                                     | 1 0 0 0 0 1 0 1 0 0 |                 |
|                                     | 0 0 0 0 0 0 1 0 0 0 |                 |
|                                     | 1 0 0 0 0 0 0 0 1 0 |                 |
|                                     | 0 0 0 1 0 0 0 0 0 1 |                 |
|                ParityCheckRows => {{0, 0, 1, 1, 0, 0, 0, 1, 0, 0}, {0, 0, 0,|
|                                                                             |
|o2 : LinearCode                                                              |
|-----------------------------------------------------------------------------|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|, 1, 0, 1, 0, 0}, {1, 1, 0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 0, 1, 1,|
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 1, 1, 0, 0, 1, 0, 0}, {1, 0, 0, 0, 0, 1, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 1, |
|-----------------------------------------------------------------------------|
|                                                                         }   |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
| 1}}                                                                         |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|                                                                             |
|0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 0, 1}}    |
+-----------------------------------------------------------------------------+
|i3 : S=toString C                                                            |
|                                                                             |
|o3 = {{0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 1, 0, 0}, {1, 1, |
|     0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 0, 1, 1, 1}}                |
+-----------------------------------------------------------------------------+

Ways to use this method:
========================

  * toString(LinearCode) -- string with the
    vectors of a generator matrix of a code

enumerateVectors -- a particular way to enumerate vectors over a finite field
*****************************************************************************

Synopsis
========

  * Usage:
        enumerateVectos(F, L)
  * Inputs:
      * L, a list (Macaulay2Doc),
      * F, a Galois field (Macaulay2Doc),
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

Given a $0$, $1$ valued list L, this function returns the list with all the
possible ways to replace the one values in L, with a nonzero element of the
finite field F.

+-----------------------------------------------------------------------------+
|i1 : F = GF(3);                                                              |
+-----------------------------------------------------------------------------+
|i2 : enumerateVectors(F, {1,0,1,0,1})                                        |
|                                                                             |
|o2 = {{1, 0, 1, 0, -1}, {-1, 0, -1, 0, 1}, {1, 0, 1, 0, 1}, {1, 0, -1, 0, 1},|
|     ------------------------------------------------------------------------|
|     {1, 0, -1, 0, -1}, {-1, 0, 1, 0, 1}, {-1, 0, 1, 0, -1}, {-1, 0, -1, 0,  |
|     ------------------------------------------------------------------------|
|     -1}}                                                                    |
|                                                                             |
|o2 : List                                                                    |
+-----------------------------------------------------------------------------+

Ways to use enumerateVectors:
=============================

  * "enumerateVectors(Ring,List)"

For the programmer
==================

The object enumerateVectors, is a method function (Macaulay2Doc).

randNoRepeats -- list of random integers from a specified range with no repetitions
***********************************************************************************

Synopsis
========

  * Usage:
        randNoRepeats(n,k)
  * Inputs:
      * n, an integer (Macaulay2Doc),
      * k, an integer (Macaulay2Doc),
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

Given the integers k and k, this function returns a list of k random integers
between $0$ and n (inclusive) with no repetitions.

It is safe to use this in applications that have nothing to do with coding
theory.

+------------------------+
|i1 : randNoRepeats(10,4)|
|                        |
|o1 = {8, 1, 3, 7}       |
|                        |
|o1 : List               |
+------------------------+
|i2 : randNoRepeats(0,1) |
|                        |
|o2 = {0}                |
|                        |
|o2 : List               |
+------------------------+
|i3 : randNoRepeats(25,5)|
|                        |
|o3 = {8, 19, 24, 25, 15}|
|                        |
|o3 : List               |
+------------------------+

Ways to use randNoRepeats:
==========================

  * "randNoRepeats(ZZ,ZZ)"

For the programmer
==================

The object randNoRepeats, is a method function (Macaulay2Doc).

reducedMatrix -- reduced matrix
*******************************

Synopsis
========

  * Usage:
        reducedMatrix(Matrix)
  * Inputs:
      * M, a matrix (Macaulay2Doc),
  * Outputs:
      * a matrix (Macaulay2Doc),

Description
===========

Returns a full rank matrix whose row space equals the row space of M.

+-------------------------------------------------------------------+
|i1 : F = GF(4);                                                    |
+-------------------------------------------------------------------+
|i2 : n = 7;                                                        |
+-------------------------------------------------------------------+
|i3 : k = 3;                                                        |
+-------------------------------------------------------------------+
|i4 : L = apply(toList(1..k),j-> apply(toList(1..n),i-> random(F)));|
+-------------------------------------------------------------------+
|i5 : m=matrix(L)                                                   |
|                                                                   |
|o5 = | 1 a+1 1   a a a+1 a |                                       |
|     | 1 a+1 a+1 1 1 1   a |                                       |
|     | 0 0   a+1 1 1 0   0 |                                       |
|                                                                   |
|             3      7                                              |
|o5 : Matrix F  <-- F                                               |
+-------------------------------------------------------------------+
|i6 : reducedMatrix(m)                                              |
|                                                                   |
|o6 = | 0   0 a+1 1 1 0 0 |                                         |
|     | 0   0 0   0 0 1 0 |                                         |
|     | a+1 a 0   0 0 0 1 |                                         |
|                                                                   |
|             3      7                                              |
|o6 : Matrix F  <-- F                                               |
+-------------------------------------------------------------------+

Ways to use reducedMatrix:
==========================

  * "reducedMatrix(Matrix)"

For the programmer
==================

The object reducedMatrix, is a method function (Macaulay2Doc).

shortestPath -- shorthest path in a digraph
*******************************************

Synopsis
========

  * Usage:
        shortestPath(D,start,finishSet)
  * Inputs:
      * D, a digraph (Graphs),
      * start, a thing (Macaulay2Doc),
      * finishSet, a list (Macaulay2Doc),
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

Given a digraph D, a vertex start in D, and a list of vertices finishSet of D,
this function returns the shortest path in D from start to finishSet.

It is safe to use this in applications that have nothing to do with coding
theory.

+-----------------------------------------------------------------------------+
|i1 : D = digraph({x,y,z,u,v}, matrix                                         |
|-----------------------------------------------------------------------------|
|{{0,1,0,1,0},{0,0,1,0,0},{0,0,0,1,1},{0,0,0,0,0},{0,0,0,0,0}});              |
+-----------------------------------------------------------------------------+
|i2 : shortestPath (D,x,{z,v})                                                |
|                                                                             |
|o2 = {x, y, z}                                                               |
|                                                                             |
|o2 : List                                                                    |
+-----------------------------------------------------------------------------+

Ways to use shortestPath:
=========================

  * "shortestPath(Digraph,Thing,List)"

For the programmer
==================

The object shortestPath, is a method function (Macaulay2Doc).