From e199ac26ce254d9f833528e9441b994f0d6cf59a Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Mon, 18 Mar 2024 22:21:01 +0500 Subject: [PATCH] iscss function --- src/ecc/ECC.jl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ecc/ECC.jl b/src/ecc/ECC.jl index b389cc67e..5859f2acd 100644 --- a/src/ecc/ECC.jl +++ b/src/ecc/ECC.jl @@ -37,7 +37,11 @@ Only CSS codes have this method. See also: [`parity_checks`](@ref)""" function parity_checks_x(code::AbstractECC) + if iscss(code) + # Existing implementation for CSS codes + else throw(lazy"Codes of type $(typeof(code)) do not have separate X and Z parity checks, either because they are not a CSS code and thus inherently do not have separate checks, or because its separate checks are not yet implemented in this library.") + end end """Parity check boolean matrix of a code (only the Z entries in the tableau, i.e. the checks for X errors). @@ -46,10 +50,16 @@ Only CSS codes have this method. See also: [`parity_checks`](@ref)""" function parity_checks_z(code::AbstractECC) + if iscss(code) + # Existing implementation for CSS codes + else throw(lazy"Codes of type $(typeof(code)) do not have separate X and Z parity checks, either because they are not a CSS code and thus inherently do not have separate checks, or because its separate checks are not yet implemented in this library.") + end end -function iscss(code::AbstractECC) = false end # Default: not CSS +function iscss(code::AbstractECC) + return false # Default: not CSS +end parity_checks(s::Stabilizer) = s Stabilizer(c::AbstractECC) = parity_checks(c)