# Invariants

## `# C: Code -> RngIntElt`

Given a code $C$, return the number of codewords belonging to $C$.

## `C . i: Code, RngIntElt -> ModTupRngElt`

## `Name(C, i): Code, RngIntElt -> ModTupRngElt`

Given a code $C$ and a positive integer $i$, return the $i$-th generator of $C$.

## `Alphabet(C): Code -> Rng`

The underlying ring (or alphabet) $R$ of the code $C$.

## `AmbientSpace(C): Code -> ModTupRng`

The ambient space of the code $C$, i.e., the generic $R$-space $V$ in which $C$ is contained.

## `Basis(C): Code -> [ ModTupRngElt ]`

The basis of the linear code $C$, returned as a sequence of elements of $C$.

## `Generators(C): Code -> { ModTupRngElt }`

The generators for the linear code $C$, returned as a set.

## `GeneratorMatrix(C): Code -> ModMatRngElt`

The generator matrix for the linear code $C$. This gives a unique canonical generating set for the code.

## `Generic(C): Code -> Code`

Given a length $n$ code $C$ over a ring $R$, return the generic $(n, \#R^n, 1)$ code in which $C$ is contained.

## `Length(C): Code -> RngIntElt`

Given a code $C$, return the block length $n$ of $C$.

## `PseudoDimension(C): Code -> RngIntElt`

## `NumberOfGenerators(C): Code -> RngIntElt`

## `Ngens(C): Code -> RngIntElt`

The number of generators (which equals the pseudo-dimension $k$) of the linear code $C$.

## `ParityCheckMatrix(C): Code -> ModMatRngElt`

The parity check matrix for the code $C$, which can be defined as the canonical generator matrix of the dual of $C$.

## `Random(C): Code -> ModTupRngElt`

A random codeword of the code $C$.

## `RSpace(C): Code -> ModTupRng`

Given a length $n$ linear code $C$, defined as a subspace $U$ of the $n$-dimensional space $V$, return $U$ as a subspace of $V$ with basis corresponding to the rows of the generator matrix for $C$.

## `InformationRate(C): Code -> RngPrElt`

Given a code $C$ over a ring with cardinality $q$, return the information rate of $C$, that is, the ratio $Log_q(\#C)/n$.
