Quantum Code API

Quantum code constructors accept symplectic matrices, CSS check pairs, or Pauli strings. They validate commutation and return the most specific supported code type, so a constructor given data with no gauge operators returns a stabilizer code, and a stabilizer code whose checks split by type returns a CSS code. Use the accessors rather than reaching into struct fields, and prefer dispatching on the traits (LogicalTrait, GaugeTrait, CSSTrait) over testing concrete types.

For a guided introduction, see Quantum Codes.

Because every stabilizer code is a subsystem code with no gauge qubits, the bulk of the shared accessors are documented on the subsystem code page; this page covers the type hierarchy, the traits, and the stabilizer-specific constructors and solvers.

CodingTheory.AbstractStabilizerCode — Type
abstract type AbstractStabilizerCode <: AbstractSubsystemCode

Supertype for stabilizer codes, represented in this hierarchy as subsystem codes without gauge qubits.

source
CodingTheory.AbstractSubsystemCode — Type
abstract type AbstractSubsystemCode <: AbstractAdditiveCode

Supertype for additive quantum subsystem codes, including stabilizer codes as the gauge-free specialization.

source
CodingTheory.BBCode — Type
mutable struct BBCode{T, U, V} <: AbstractStabilizerCodeCSS

A finite bivariate-bicycle CSS stabilizer code.

Representation-specific information (a standard quotient, a twisted Laurent lattice, or a coprime univariate quotient) is retained in R, a1, a2, and N. Derived matrices and code metadata live in cache.

source
CodingTheory.CSSTrait — Type
abstract type CSSTrait

Holy-trait function and root trait type that map a quantum code type to IsCSS or IsNotCSS. Dispatch on this trait instead of testing concrete code types.

source
CodingTheory.GaugeTrait — Type
abstract type GaugeTrait

Holy-trait function and root trait type that map a quantum code type to HasGauges or HasNoGauges. Dispatch on this trait instead of testing concrete code types.

source
CodingTheory.HasGauges — Type
struct HasGauges <: GaugeTrait

Singleton trait returned by GaugeTrait for subsystem-code types with gauge operators.

source
CodingTheory.HasLogicals — Type
struct HasLogicals <: LogicalTrait

Singleton trait returned by LogicalTrait for code types that carry logical operators.

source
CodingTheory.HasNoGauges — Type
struct HasNoGauges <: GaugeTrait

Singleton trait returned by GaugeTrait for stabilizer-code types without gauge operators.

source
CodingTheory.HasNoLogicals — Type
struct HasNoLogicals <: LogicalTrait

Singleton trait returned by LogicalTrait for graph-state code types, which do not carry logical operators.

source
CodingTheory.InfiniteBBCode — Type
struct InfiniteBBCode{T, U, V}

An algebraic bivariate-bicycle datum before a finite lattice is chosen.

This is deliberately not an AbstractSubsystemCode: it has no finite block length or stabilizer matrix.

source
CodingTheory.IsCSS — Type
struct IsCSS <: CSSTrait

Singleton trait returned by CSSTrait for code types in CSSTypes.

source
CodingTheory.LiftedProductCode — Type
mutable struct LiftedProductCode{T} <: AbstractStabilizerCodeCSS

A CSS stabilizer code defined by a lifted-product construction from matrices A and B.

source
CodingTheory.LogicalTrait — Type
abstract type LogicalTrait

Holy-trait function and root trait type that map a quantum code type to HasLogicals or HasNoLogicals. Dispatch on this trait instead of testing concrete code types.

source
CodingTheory.QuantumConcatenatedCode — Type
mutable struct QuantumConcatenatedCode <: AbstractStabilizerCode

A stabilizer code formed by concatenating an outer stabilizer code with an inner stabilizer code.

source
CodingTheory.StabilizerCode — Method
StabilizerCode(
    C::AbstractLinearCode,
    F::AbstractAlgebra.FinField;
    basis,
    char_vec,
    logs_alg
) -> Union{StabilizerCode, StabilizerCodeCSS}

Return the symplectic stabilizer code over F associated with a Hermitian self-orthogonal linear code over the quadratic extension of F. The optional basis is an ordered extension basis; a primitive basis is used by default.

source
CodingTheory.StabilizerCode — Method
StabilizerCode(
    stabs::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC};
    char_vec,
    logs_alg
) -> Union{StabilizerCode, StabilizerCodeCSS}

Return the stabilizer code whose stabilizers is determined by stabs.

source
CodingTheory.StabilizerCode — Method
StabilizerCode(
    S_Pauli::Array{T<:Union{String, Vector{Char}}, 1};
    char_vec,
    logs_alg
) -> Union{StabilizerCode, StabilizerCodeCSS}
source
CodingTheory.StabilizerCodeCSS — Method
StabilizerCodeCSS(C1::AbstractLinearCode, C2::AbstractLinearCode; char_vec::Union{Vector{zzModRingElem}, Missing} = missing, logs_alg::Symbol = :stnd_frm)
CSSCode(C1::AbstractLinearCode, C2::AbstractLinearCode; char_vec::Union{Vector{zzModRingElem}, Missing} = missing, logs_alg::Symbol = :stnd_frm)
source
CodingTheory.StabilizerCodeCSS — Method
StabilizerCodeCSS(C::AbstractLinearCode; char_vec::Union{Vector{zzModRingElem}, Missing} = missing, logs_alg::Symbol = :stnd_frm)
CSSCode(C::AbstractLinearCode; char_vec::Union{Vector{zzModRingElem}, Missing} = missing, logs_alg::Symbol = :stnd_frm)
source
CodingTheory.StabilizerCodeCSS — Method
StabilizerCodeCSS(X_matrix::CTMatrixTypes, Z_matrix::CTMatrixTypes; char_vec::Union{Vector{zzModRingElem}, Missing} = missing, logs_alg::Symbol = :stnd_frm)
CSSCode(X_matrix::CTMatrixTypes, Z_matrix::CTMatrixTypes; char_vec::Union{Vector{zzModRingElem}, Missing}= missing, logs_alg::Symbol = :stnd_frm)

Return a CSS code whose X-stabilizers are given by X_matrix, Z-stabilizers by Z_matrix.

source
CodingTheory.StabilizerCodeCSS — Method
StabilizerCodeCSS(
    S_Pauli::Array{T<:Union{String, Vector{Char}}, 1};
    char_vec,
    logs_alg
) -> Union{StabilizerCode, StabilizerCodeCSS}
source
CodingTheory.CSSCode — Method
CSSCode(
    X_matrix::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC},
    Z_matrix::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC};
    char_vec,
    logs_alg
) -> StabilizerCodeCSS

Return the CSS stabilizer code whose trimmed X- and Z-stabilizer matrices are X_matrix and Z_matrix. This is an alias for StabilizerCodeCSS.

source
CodingTheory.is_triorthogonal — Method
is_triorthogonal(
    S::AbstractStabilizerCodeCSS;
    verbose
) -> Any

Return true if the CSS code S is triorthogonal. Cached to avoid recomputing on subsequent checks.

source
CodingTheory.random_CSS_code — Method
random_CSS_code(n::Int64, k::Int64) -> StabilizerCodeCSS

Return a random CSS code with an equal number of X and Z stabilizers.

source
CodingTheory.random_stabilizer_code — Method
random_stabilizer_code(
    rng::Random.AbstractRNG,
    F::AbstractAlgebra.FinField,
    n::Int64,
    k::Union{Int64, Rational};
    char_vec
) -> Union{StabilizerCode, StabilizerCodeCSS}

Return a random, not necessarily uniformly sampled, $[[n, k]]$ stabilizer code over F.

source