---
title: "Properties of Codes"
canonical: "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodes/Boolean.html"
source: "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodes/Boolean.md"
part: "Coding Theory"
chapter: "Linear Codes over Finite Fields"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Coding Theory", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/index-coding-theory.md"}
  - {"title": "Linear Codes over Finite Fields", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodes/index-linear-codes.md"}
prev: {"title": "Subcodes", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodes/subcode.md"}
next: {"title": "The Weight Distribution", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/LinearCodes/structural.md"}
intrinsics:
  - {"name": "IsCyclic", "signature": "IsCyclic(C): Code -> BoolElt"}
  - {"name": "IsSelfDual", "signature": "IsSelfDual(C): Code -> BoolElt"}
  - {"name": "IsSelfOrthogonal", "signature": "IsSelfOrthogonal(C): Code -> BoolElt"}
  - {"name": "IsHermitianSelfDual", "signature": "IsHermitianSelfDual(C): CodeLinFld -> BoolElt"}
  - {"name": "IsHermitianSelfOrthogonal", "signature": "IsHermitianSelfOrthogonal(C): CodeLinFld -> BoolElt"}
  - {"name": "IsMaximumDistanceSeparable", "signature": "IsMaximumDistanceSeparable(C): Code -> BoolElt"}
  - {"name": "IsMDS", "signature": "IsMDS(C): Code -> BoolElt"}
  - {"name": "IsEquidistant", "signature": "IsEquidistant(C): Code -> BoolElt"}
  - {"name": "IsPerfect", "signature": "IsPerfect(C): Code -> BoolElt"}
  - {"name": "IsNearlyPerfect", "signature": "IsNearlyPerfect(C): Code -> BoolElt"}
  - {"name": "IsEven", "signature": "IsEven(C): Code -> BoolElt"}
  - {"name": "IsDoublyEven", "signature": "IsDoublyEven(C): Code -> BoolElt"}
  - {"name": "IsProjective", "signature": "IsProjective(C): Code -> BoolElt"}
examples:
  - "ex-a18e45"
  - "ex-f19a8e"
---

# Properties of Codes

For the following operators, $C$ and $D$ are codes defined as a subset (or subspace) of the vector space $V$.

<a id="function-iscyclic-code"></a>
## `IsCyclic(C): Code -> BoolElt`

Return `true` if and only if the linear code $C$ is a cyclic code.

<a id="function-isselfdual-code"></a>
## `IsSelfDual(C): Code -> BoolElt`

Return `true` if and only if the linear code $C$ is self-dual. (i.e. $C$ equals the dual of $C$).

<a id="function-isselforthogonal-code"></a>
## `IsSelfOrthogonal(C): Code -> BoolElt`

Return `true` if and only if the linear code $C$ is self-orthogonal (i.e., $C$ is contained in the dual of $C$).

<a id="function-ishermitianselfdual-codelinfld"></a>
## `IsHermitianSelfDual(C): CodeLinFld -> BoolElt`

Return `true` if and only if the linear code $C$ equals the Hermitian dual of $C$.

<a id="function-ishermitianselforthogonal-codelinfld"></a>
## `IsHermitianSelfOrthogonal(C): CodeLinFld -> BoolElt`

Return `true` if and only if the linear code $C$ is contained in the Hermitian dual of $C$.

<a id="function-ismaximumdistanceseparable-code"></a>
## `IsMaximumDistanceSeparable(C): Code -> BoolElt`

<a id="function-ismds-code"></a>
## `IsMDS(C): Code -> BoolElt`

Returns `true` if and only if the linear code $C$ is maximum-distance separable; that is, has parameters $[n, k, n - k + 1]$.

<a id="function-isequidistant-code"></a>
## `IsEquidistant(C): Code -> BoolElt`

Returns `true` if and only if the linear code $C$ is equidistant.

<a id="function-isperfect-code"></a>
## `IsPerfect(C): Code -> BoolElt`

Returns `true` if and only if the linear code $C$ is perfect; that is, if and only if the cardinality of $C$ is equal to the size of the sphere packing bound of $C$.

<a id="function-isnearlyperfect-code"></a>
## `IsNearlyPerfect(C): Code -> BoolElt`

Returns `true` if and only if the binary linear code $C$ is nearly perfect.

<a id="function-iseven-code"></a>
## `IsEven(C): Code -> BoolElt`

Returns `true` if and only if $C$ is an even linear binary code, (i.e., all codewords have even weight). If `true`, then Magma will adjust the upper and lower minimum weight bounds of $C$ if possible.

<a id="function-isdoublyeven-code"></a>
## `IsDoublyEven(C): Code -> BoolElt`

Returns `true` if and only if $C$ is a doubly even linear binary code, (i.e., all codewords have weight divisible by $4$). If `true`, then Magma will adjust the upper and lower minimum weight bounds of $C$ if possible.

<a id="function-isprojective-code"></a>
## `IsProjective(C): Code -> BoolElt`

Returns `true` if and only if the (non-quantum) code $C$ is projective.

<a id="example-ex-a18e45"></a>
## `Example: Self-Dual Code (ex-a18e45)`

We look at an extended quadratic residue code over $GF(2)$ which is self-dual, and then confirm it manually.

```magma
> C := ExtendCode( QRCode(GF(2),23) );
> C:Minimal;
[24, 12, 8] Linear Code over GF(2)
> IsSelfDual(C);
true
> D := Dual(C);
> D: Minimal;
[24, 12, 8] Linear Code over GF(2)
> C eq D;
true
```

<a id="example-ex-f19a8e"></a>
## `Example: Self-Orthogonal Code (ex-f19a8e)`

We look at the `CordaroWagnerCode` of length $6$, which is self-orthogonal, and then confirm it manually.

```magma
> C := CordaroWagnerCode(6);
> C;
[6, 2, 4] Linear Code over GF(2)
Generator matrix:
[1 1 0 0 1 1]
[0 0 1 1 1 1]
> IsSelfOrthogonal(C);
true
> D := Dual(C);
> D;
[6, 4, 2] Linear Code over GF(2)
Generator matrix:
[1 0 0 1 0 1]
[0 1 0 1 0 1]
[0 0 1 1 0 0]
[0 0 0 0 1 1]
> C subset D;
true
```
