From 6035ff92714b59db3a7d38b7066d035870c20ed4 Mon Sep 17 00:00:00 2001 From: Feroz <93876775+Fe-r-oz@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:15:27 +0500 Subject: [PATCH] Update and rename qhammingcode.jl to eightqubit.jl --- src/ecc/codes/eightqubit.jl | 10 ++++++++++ src/ecc/codes/qhammingcode.jl | 31 ------------------------------- 2 files changed, 10 insertions(+), 31 deletions(-) create mode 100644 src/ecc/codes/eightqubit.jl delete mode 100644 src/ecc/codes/qhammingcode.jl diff --git a/src/ecc/codes/eightqubit.jl b/src/ecc/codes/eightqubit.jl new file mode 100644 index 000000000..9e226ee7e --- /dev/null +++ b/src/ecc/codes/eightqubit.jl @@ -0,0 +1,10 @@ +struct EightQubit <: AbstractECC end + +code_n(c::EightQubit) = 8 + +parity_checks(c::EightQubit) = S"XXXXXXXX + ZZZZZZZZ + _X_XYZYZ + _XZY_XZY + _YXZXZ_Y" +distance(c::EightQubit) = 3 diff --git a/src/ecc/codes/qhammingcode.jl b/src/ecc/codes/qhammingcode.jl deleted file mode 100644 index ad3897801..000000000 --- a/src/ecc/codes/qhammingcode.jl +++ /dev/null @@ -1,31 +0,0 @@ -struct QHamming <:AbstractECC - r::Int -end - -function parity_checks(c::QHamming) - r = c.r - n = 2^r - k = 2^r - r - 2 # Calculate number of checks - - # Initialize parity check matrix - H = zeros(Bool, k, n) - - # Generate parity checks for the quantum Hamming code - for i in 1:k - for j in 1:n - if j & (1 << (i - 1)) != 0 - H[i, j] = true - end - end - end - - - # Extract Hx and Hz from H - Hx = H[:, 1:end-r] - Hz = H[:, end-r+1:end] - - # Construct the Stabilizer object using the built-in constructor - Stabilizer(fill(0x0, 2k), Hx, Hz) -end - -