Subsystem Codes and Shared Accessors

A subsystem code is a stabilizer code in which some logical qubits are designated as gauge qubits and left unprotected. Because a stabilizer code is the special case with no gauge qubits, this file supplies the accessors used by every quantum code in the library, which is why the general accessors appear here rather than on the core API page.

The distinction that runs through this page is between the stabilizer group, the gauge group, and the logical operators. Bare logical operators commute with the entire gauge group; dressed logical operators need only commute with the stabilizer group, so they may be multiplied by gauge operators and can have lower weight. Functions come in bare and dressed forms wherever the two differ, and conflating them will give the wrong distance.

Operators are returned either as matrices in symplectic $[X \mid Z]$ form or as vectors of operator pairs, depending on the function; the docstrings say which. Signs are tracked separately through the character vector.

promote_gauges_to_logical and promote_logicals_to_gauge move qubits between the two roles, which is the usual way to trade protected qubits for a lower measurement weight. The ! forms modify the code in place.

CodingTheory.SubsystemCodeMethod
SubsystemCode(
    C::AbstractLinearCode,
    F::AbstractAlgebra.FinField;
    basis,
    char_vec
) -> Union{StabilizerCode, StabilizerCodeCSS, SubsystemCode, SubsystemCodeCSS}

Return the subsystem code over F whose gauge space is the additive symplectic image of a linear code over the quadratic extension of F.

source
CodingTheory.SubsystemCodeMethod
SubsystemCode(
    S::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC},
    L::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC},
    G::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC};
    char_vec
) -> Union{SubsystemCode, SubsystemCodeCSS}

Return the subsystem code whose stabilizers are given by S, (bare) logical operators by L, gauge operators (not including stabilizers) by G.

source
CodingTheory.SubsystemCodeMethod
SubsystemCode(
    G::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC};
    char_vec
) -> Union{StabilizerCode, StabilizerCodeCSS, SubsystemCode, SubsystemCodeCSS}

Return the subsystem code whose gauge group is determined by G.

source
CodingTheory.SubsystemCodeMethod
SubsystemCode(
    S_Pauli::Array{T<:Union{String, Vector{Char}}, 1},
    L_Pauli::Array{T<:Union{String, Vector{Char}}, 1},
    G_Pauli::Array{T<:Union{String, Vector{Char}}, 1};
    char_vec
) -> Union{SubsystemCode, SubsystemCodeCSS}
source
CodingTheory.SubsystemCodeMethod
SubsystemCode(
    G_Pauli::Array{T<:Union{String, Vector{Char}}, 1};
    char_vec
) -> Union{StabilizerCode, StabilizerCodeCSS, SubsystemCode, SubsystemCodeCSS}

Return the subsystem code whose gauge group is determined by the vector of Pauli strings G_Pauli.

source
CodingTheory.SubsystemCodeCSSMethod
SubsystemCodeCSS(X_gauges, Z_gauges; char_vec=missing)
CSSSubsystemCode(X_gauges, Z_gauges; char_vec=missing)

Return the CSS subsystem code defined by trimmed X- and Z-type gauge generators. The constructor may return a stabilizer code when the gauge group is abelian.

source
Base.lengthMethod
length(S::AbstractSubsystemCode)
num_qubits(S::AbstractSubsystemCode)

Return the length of the code.

source
CodingTheory.CSSSubsystemCodeMethod
CSSSubsystemCode(args...; kwargs...) -> Any

Return a CSS subsystem code from X- and Z-type gauge generators. This is an alias for SubsystemCodeCSS.

source
CodingTheory.X_metacheckMethod
X_metacheck(S::AbstractSubsystemCode) -> Any

Return the $X$-metacheck matrix of the CSS code S if it has been set and missing otherwise. This matrix annihilates the $X$ stabilizer matrix and so detects errors in the measured $X$ syndrome.

source
CodingTheory.X_signsMethod
X_signs(S::AbstractSubsystemCode) -> Any

Return the signs of the X stabilizers of the CSS code.

source
CodingTheory.X_syndromeMethod
X_syndrome(
    S::AbstractSubsystemCode,
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any

Return the $X$ syndrome of the vector v with respect to the CSS code S.

Notes

  • v may be given either as the length-$n$ $Z$ component or as a full symplectic $[X \mid Z]$ vector of length $2n$, since the $X$ checks detect $Z$ errors.
source
CodingTheory.Z_metacheckMethod
Z_metacheck(S::AbstractSubsystemCode) -> Any

Return the $Z$-metacheck matrix of the CSS code S if it has been set and missing otherwise. This matrix annihilates the $Z$ stabilizer matrix and so detects errors in the measured $Z$ syndrome.

source
CodingTheory.Z_signsMethod
Z_signs(S::AbstractSubsystemCode) -> Any

Return the signs of the Z stabilizers of the CSS code.

source
CodingTheory.Z_syndromeMethod
Z_syndrome(
    S::AbstractSubsystemCode,
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any

Return the $Z$ syndrome of the vector v with respect to the CSS code S.

Notes

  • v may be given either as the length-$n$ $X$ component or as a full symplectic $[X \mid Z]$ vector of length $2n$, since the $Z$ checks detect $X$ errors.
source
CodingTheory.bareMethod
bare(S::AbstractSubsystemCode) -> Any

Return the bare logical generators as a vector of symplectic operator pairs. This is an alias for logicals.

source
CodingTheory.bare_logicalsMethod
bare_logicals(S::AbstractSubsystemCode) -> Any

Return the bare logical generators as a vector of symplectic operator pairs. Each operator commutes with the gauge group. This is an alias for logicals.

source
CodingTheory.bare_normalizer_matrixMethod
bare_normalizer_matrix(S::AbstractSubsystemCode) -> Any

Return a row basis in symplectic $[X \mid Z]$ form for the centralizer of the gauge group. This is an alias for gauge_centralizer_matrix.

source
CodingTheory.dressedMethod
dressed(S::AbstractSubsystemCode)
dressed_operators(S::AbstractSubsystemCode
dressed_logicals(S::AbstractSubsystemCode)

Return a vector of pairs generators for the dressed operators of S.

Notes

  • Here, the dressed operators are the logicals and the gauge operators.
source
CodingTheory.dressed_logicalsMethod
dressed_logicals(S::AbstractSubsystemCode) -> Any

Return the dressed logical generators as the union of the bare logical and gauge operator pairs. These operators commute with the stabilizer group but need not commute with the gauge group. This is an alias for dressed.

source
CodingTheory.dressed_operatorsMethod
dressed_operators(S::AbstractSubsystemCode) -> Any

Return the dressed logical generators as the union of the bare logical and gauge operator pairs. These operators commute with the stabilizer group but need not commute with the gauge group. This is an alias for dressed.

source
CodingTheory.fix_all_gaugesMethod
fix_all_gauges(
    S::AbstractSubsystemCode;
    choice
) -> Union{StabilizerCode, StabilizerCodeCSS}

Return the stabilizer code obtained by promoting one commuting half of every gauge pair to stabilizers.

source
CodingTheory.gauge_generators_matrixMethod
gauge_generators_matrix(S::AbstractSubsystemCode) -> Any

Return a possibly overcomplete symplectic $[X \mid Z]$ generator matrix for the gauge group. This is an alias for gauge_group.

source
CodingTheory.gauge_groupMethod
gauge_group(S::AbstractSubsystemCode)
gauge_group_matrix(S::AbstractSubsystemCode)
gauge_generators_matrix(S::AbstractSubsystemCode)
gauge_group_generators_matrix(S::AbstractSubsystemCode)

Return a matrix giving a (maybe overcomplete) basis for the gauge group.

source
CodingTheory.gauge_group_generators_matrixMethod
gauge_group_generators_matrix(
    S::AbstractSubsystemCode
) -> Any

Return a possibly overcomplete symplectic $[X \mid Z]$ generator matrix for the gauge group. This is an alias for gauge_group.

source
CodingTheory.gauge_group_matrixMethod
gauge_group_matrix(S::AbstractSubsystemCode) -> Any

Return a possibly overcomplete symplectic $[X \mid Z]$ generator matrix for the gauge group. This is an alias for gauge_group.

source
CodingTheory.gauge_operatorsMethod
gauge_operators(S::AbstractSubsystemCode) -> Any

Return the gauge generators as a vector of symplectic operator pairs. This is an alias for gauges.

source
CodingTheory.gauge_operators_matrixMethod
gauge_operators_matrix(S::AbstractSubsystemCode) -> Any

Return the gauge operator pairs as a vertically concatenated symplectic $[X \mid Z]$ matrix. This is an alias for gauges_matrix.

source
CodingTheory.gaugesMethod
gauges(S::AbstractSubsystemCode)
gauge_operators(S::AbstractSubsystemCode)

Return a vector of gauge operator generator pairs for S.

source
CodingTheory.gauges_matrixMethod
gauges_matrix(S::AbstractSubsystemCode)
gauge_operators_matrix(S::AbstractSubsystemCode)

Return the result of gauges(S) as a vertically concatenated matrix.

source
CodingTheory.is_bare_logicalMethod
is_bare_logical(
    S::AbstractSubsystemCode,
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any

Return whether v is a nontrivial bare logical: it centralizes the gauge group but is not a stabilizer.

source
CodingTheory.is_bare_normalizerMethod
is_bare_normalizer(
    S::AbstractSubsystemCode,
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any

Return whether v commutes with the full gauge group.

source
CodingTheory.is_gaugeMethod
is_gauge(
    S::AbstractSubsystemCode,
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any
source
CodingTheory.is_logicalMethod
is_logical(
    S::AbstractSubsystemCode,
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any
source
CodingTheory.is_normalizerMethod
is_normalizer(
    S::AbstractSubsystemCode,
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any

Return whether v commutes with every stabilizer.

source
CodingTheory.is_stabilizerMethod
is_stabilizer(
    S::AbstractSubsystemCode,
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any

Return whether v belongs to the row space of the stabilizer generators.

source
CodingTheory.logical_operatorsMethod
logical_operators(S::AbstractSubsystemCode) -> Any

Return the logical operator generators as a vector of symplectic operator pairs. For subsystem codes these are bare logicals, which commute with the gauge group. This is an alias for logicals.

source
CodingTheory.logicalsMethod
logicals(S::AbstractSubsystemCode)
logical_operators(S::AbstractSubsystemCode)
bare_logicals(S::AbstractSubsystemCode)
bare(S::AbstractSubsystemCode)

Return a vector of logical operator generator pairs for S.

source
CodingTheory.metacheckMethod
metacheck(S::AbstractSubsystemCode) -> Any

Return the metacheck matrix of S if it has been set and missing otherwise.

Notes

  • A metacheck matrix $M$ satisfies $M H = 0$ for the stabilizer matrix $H$, so it detects errors in the measured syndrome itself and is what makes single-shot decoding possible.
  • For a CSS code use X_metacheck or Z_metacheck instead.
source
CodingTheory.minimum_stabilizer_weightMethod
minimum_stabilizer_weight(
    S::AbstractSubsystemCode;
    alg
) -> Any

Return the minimum Pauli weight of a nonidentity stabilizer. For CSS codes this uses the classical minimum-distance machinery on each sector. General symplectic groups are enumerated exactly.

source
CodingTheory.normalizer_matrixMethod
normalizer_matrix(S)
stabilizer_centralizer_matrix(S)

Return a row basis for the symplectic centralizer (Pauli normalizer) of the stabilizer group.

source
CodingTheory.permute_code!Method
permute_code(S::AbstractSubsystemCode, σ::Union{PermGroupElem, Perm{Int}, Vector{Int}})
permute_code!(S::AbstractSubsystemCode, σ::Union{PermGroupElem, Perm{Int}, Vector{Int}})
source
CodingTheory.promote_gauges_to_logicalMethod
promote_gauges_to_logical(
    S::AbstractSubsystemCode,
    pairs::Vector{Int64}
) -> AbstractSubsystemCode

Return a copy of S with the selected gauge pairs promoted to bare logical pairs, leaving S unchanged.

source
CodingTheory.promote_logicals_to_gaugeMethod
promote_logicals_to_gauge(
    S::AbstractSubsystemCode,
    pairs::Vector{Int64}
) -> AbstractSubsystemCode

Return a copy of S with the selected logical pairs promoted to gauge pairs, leaving S unchanged.

source
CodingTheory.random_subsystem_codeMethod
random_subsystem_code(
    rng::Random.AbstractRNG,
    F::AbstractAlgebra.FinField,
    n::Int64,
    k::Union{Int64, Rational},
    r::Int64;
    char_vec
) -> Union{StabilizerCode, StabilizerCodeCSS, SubsystemCode, SubsystemCodeCSS}

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

source
CodingTheory.relative_distanceMethod
relative_distance(S::AbstractSubsystemCode) -> Any

Return the relative minimum distance, δ = d / n of the code if d is known, otherwise errors.

source
CodingTheory.set_X_metacheck!Method
set_X_metacheck!(
    S::AbstractSubsystemCode,
    M::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
)

Set the $X$-metacheck matrix of the CSS code S to M and return nothing. Throws an error unless M annihilates the $X$ stabilizer matrix.

source
CodingTheory.set_X_stabilizers!Method
set_X_stabilizers!(
    S::AbstractSubsystemCode,
    X_stabs::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC};
    trimmed
)
source
CodingTheory.set_X_stabilizersMethod
set_X_stabilizers(
    S::AbstractSubsystemCode,
    X_stabs::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC};
    trimmed
) -> AbstractSubsystemCode

Return a copy of the CSS code S using the equivalent X-stabilizer presentation X_stabs, leaving S unchanged. If trimmed is false, X_stabs must be a symplectic $[X \mid 0]$ matrix.

source
CodingTheory.set_Z_metacheck!Method
set_Z_metacheck!(
    S::AbstractSubsystemCode,
    M::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
)

Set the $Z$-metacheck matrix of the CSS code S to M and return nothing. Throws an error unless M annihilates the $Z$ stabilizer matrix.

source
CodingTheory.set_Z_stabilizers!Method
set_Z_stabilizers!(
    S::AbstractSubsystemCode,
    Z_stabs::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC};
    trimmed
)
source
CodingTheory.set_Z_stabilizersMethod
set_Z_stabilizers(
    S::AbstractSubsystemCode,
    Z_stabs::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC};
    trimmed
) -> AbstractSubsystemCode

Return a copy of the CSS code S using the equivalent Z-stabilizer presentation Z_stabs, leaving S unchanged. If trimmed is false, Z_stabs must be a symplectic $[0 \mid Z]$ matrix.

source
CodingTheory.set_logicals!Method
set_logicals!(
    S::AbstractSubsystemCode,
    L::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
)
source
CodingTheory.set_metacheck!Method
set_metacheck!(
    S::AbstractSubsystemCode,
    M::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
)

Set the metacheck matrix of S to M and return nothing.

Notes

  • Throws an error unless $M H = 0$ for the stabilizer matrix $H$.
  • For a CSS code use set_X_metacheck! or set_Z_metacheck! instead.
source
CodingTheory.set_signs!Method
set_signs(S::AbstractSubsystemCode, char_vec::Vector{zzModRingElem})
set_signs!(S::AbstractSubsystemCode, char_vec::Vector{zzModRingElem})

Set the character vector of S to char_vec and update the signs.

source
CodingTheory.set_stabilizers!Method
set_stabilizers(S::AbstractSubsystemCode, stabs::CTMatrixTypes)
set_stabilizers!(S::AbstractSubsystemCode, stabs::CTMatrixTypes)

Set the stabilizers of S to stabs.

source
CodingTheory.set_stabilizersMethod
set_stabilizers(
    S::AbstractSubsystemCode,
    stabs::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> AbstractSubsystemCode

Return a copy of S using the equivalent stabilizer presentation stabs, leaving S unchanged. The input must span the current stabilizer group.

source
CodingTheory.signsMethod
signs(S::AbstractSubsystemCode) -> Any

Return the signs of the stabilizers of the code. Lazily computes them if a non-trivial character vector exists.

source
CodingTheory.stabilizer_centralizer_matrixMethod
stabilizer_centralizer_matrix(
    S::AbstractSubsystemCode
) -> Any

Return a row basis in symplectic $[X \mid Z]$ form for the centralizer of the stabilizer group. This is an alias for normalizer_matrix.

source
CodingTheory.stabilizersMethod
stabilizers(S::AbstractSubsystemCode; standform) -> Any

Return the stabilizer matrix of the code. Computes the unified matrix for CSS codes if missing.

Notes

  • If the optional parameter standform is set to true, the standard form of the stabilizer matrix is returned instead (computed densely, stored sparsely if applicable).
source
CodingTheory.standard_form_permutationMethod
standard_form_permutation(S::AbstractSubsystemCode) -> Any

Return the permutation matrix required to permute the columns of the code matrices to have the same row space as the matrices in standard form. Returns missing if no such permutation is required.

source
CodingTheory.symplectic_weightMethod
symplectic_weight(
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any

Return the Pauli weight of a symplectic vector, counting a nonzero X or Z component on a coordinate once.

source
CodingTheory.syndromeMethod
syndrome(
    S::AbstractSubsystemCode,
    v::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC}
) -> Any
source
Hecke.dimensionMethod
dimension(S::AbstractSubsystemCode) -> Any

Return the dimension of the code.

source
Hecke.is_pureMethod
is_pure(S; distance=missing, alg=:auto)
is_degenerate(S; distance=missing, alg=:auto)

Return true if the minimum stabilizer-group weight (for a stabilizer code) or gauge-group weight (for a subsystem code) is at least the exact code distance; otherwise, return false. This does not require a full weight enumerator, but the minimum-group-weight computation can still be exponential.

source
Oscar.fieldMethod
field(S::AbstractSubsystemCode) -> Any

Return the base ring of the code.

source