---
title: "Low Density Parity Check Codes"
canonical: "https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/index-low-density-parity-check-codes.html"
source: "https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/index-low-density-parity-check-codes.md"
part: "Coding Theory"
chapter: "Low Density Parity Check Codes"
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"}
prev: {"title": "Bibliography", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/AlgebraicGeometricCodes/bibliography.md"}
next: {"title": "Introduction", "source": "https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md"}
---

<a id="error-correcting-linear-code"></a>
<a id="chap-codeldpc"></a>
# Low Density Parity Check Codes

- [Introduction](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md)
  - [Constructing LDPC Codes](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#constructing-ldpc-codes)
    - [`LDPCCode(H): MtrxSprs → Code`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpccode-mtrxsprs)
    - [`GallagerCode(n, a, b): RngIntElt, RngIntElt, RngIntElt → Code`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-gallagercode-rngintelt-rngintelt-rngintelt)
    - [`RegularLDPCEnsemble(n, a, b): RngIntElt, RngIntElt, RngIntElt → Code`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-regularldpcensemble-rngintelt-rngintelt-rngintelt)
    - [`IrregularLDPCEnsemble(n, Sc, Sv): RngIntElt, SeqEnum, SeqEnum → Code`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-irregularldpcensemble-rngintelt-seqenum-seqenum)
    - [`MargulisCode(p): RngIntElt → Code`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-marguliscode-rngintelt)
    - [Example: Saving and Reusing an LDPC Code](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#example-ex-f1c0a4)
  - [Access Functions](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#access-functions)
    - [`IsLDPC(C): Code → BoolElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-isldpc-code)
    - [`AssignLDPCMatrix(~C, H): Code, MtrxSprs`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#procedure-assignldpcmatrix-code-mtrxsprs-ref)
    - [`LDPCMatrix(C): Code → MtrxSprs`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcmatrix-code)
    - [`LDPCDensity(C): Code → FldReElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcdensity-code)
    - [`IsRegularLDPC(C): Code → BoolElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-isregularldpc-code)
    - [`TannerGraph(C): Code → Grph`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-tannergraph-code)
    - [`LDPCGirth(C): Code → RngIntElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcgirth-code)
    - [`LDPCEnsembleRate(v, c): RngIntElt, RngIntElt → FldReElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcensemblerate-rngintelt-rngintelt)
    - [`LDPCEnsembleRate(Sv, Sc): [FldReElt], [FldReElt] → FldReElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcensemblerate-fldreelt-fldreelt)
    - [Example: Assigning an LDPC Matrix to Any Code](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#example-ex-69eb66)
  - [LDPC Decoding and Simulation](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#ldpc-decoding-and-simulation)
    - [`LDPCDecode(C, v): Code, ModTupRngElt → ModTupRngElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcdecode-code-modtuprngelt)
    - [Example: LDPC Decoding on a Binary Symmetric Channel](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#example-ex-ece197)
    - [Example: LDPC Decoding on a Gaussian Channel](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#example-ex-557473)
    - [`LDPCSimulate(C, N): Code, RngIntElt → FldReElt, FldReElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcsimulate-code-rngintelt)
    - [Example: Simulating LDPC Error Rates](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#example-ex-103564)
  - [Density Evolution](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#density-evolution)
    - [`LDPCBinarySymmetricThreshold(v, c): RngIntElt, RngIntElt → FldReElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcbinarysymmetricthreshold-rngintelt-rngintelt)
    - [`LDPCBinarySymmetricThreshold(Sv, Sc): [FldReElt], [FldReElt] → FldReElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcbinarysymmetricthreshold-fldreelt-fldreelt)
    - [`DensityEvolutionBinarySymmetric(v, c, p): RngIntElt, RngIntElt, FldReElt → BoolElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-densityevolutionbinarysymmetric-rngintelt-rngintelt-fldreelt)
    - [`DensityEvolutionBinarySymmetric(Sv, Sc, p): [FldReElt], [FldReElt], FldReElt → BoolElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-densityevolutionbinarysymmetric-fldreelt-fldreelt-fldreelt)
    - [Example: Density Evolution on a Binary Symmetric Channel](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#example-ex-b0bbfa)
    - [`LDPCGaussianThreshold(v, c): RngIntElt, RngIntElt → FldReElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcgaussianthreshold-rngintelt-rngintelt)
    - [`LDPCGaussianThreshold(Sv, Sc): [FldReElt], [FldReElt] → FldReElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-ldpcgaussianthreshold-fldreelt-fldreelt)
    - [`DensityEvolutionGaussian(v, c, σ): RngIntElt, RngIntElt, FldReElt → BoolElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-densityevolutiongaussian-rngintelt-rngintelt-fldreelt)
    - [`DensityEvolutionGaussian(Sv, Sc, σ): [FldReElt], [FldReElt], FldReElt → BoolElt`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-densityevolutiongaussian-fldreelt-fldreelt-fldreelt)
    - [`GoodLDPCEnsemble(i): RngIntElt → FldReElt, [FldReElt], [FldReElt]`](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#function-goodldpcensemble-rngintelt)
    - [Example: Density Evolution on a Gaussian Channel](https://docs.magma-maths.org/v2.30-1/CodingTheory/LowDensityParityCheckCodes/introduction.md#example-ex-4cd36e)
