-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
function get_stab(matrix::SparseMatrixCSC{Int, Int}, logical_operator_type::Symbol) | ||
rows, cols = size(matrix) | ||
if logical_operator_type == :Z | ||
col_range = 1:div(cols, 2) | ||
else logical_operator_type == :X | ||
col_range = div(cols, 2) + 1:cols | ||
end | ||
submatrix = matrix[:, col_range] | ||
non_zero_rows = unique(submatrix.rowval) | ||
zero_rows = setdiff(1:rows, non_zero_rows) | ||
return matrix[zero_rows, :] | ||
end | ||
""" | ||
A logical X-type operator \$L_x\$ satisfies the | ||
following two conditions: | ||
1. \$L_x \\in \\ker(H_z)\$ | ||
2. \$L_x \\notin \\text{Im}(H_x^T)\$ | ||
function get_lx_lz(c::Stabilizer) | ||
lx = stab_to_gf2(logicalxview(canonicalize!(MixedDestabilizer(c)))) | ||
lz = stab_to_gf2(logicalzview(canonicalize!(MixedDestabilizer(c)))) | ||
lx = SparseMatrixCSC{Int, Int}(lx) | ||
lz = SparseMatrixCSC{Int, Int}(lz) | ||
return lx, lz | ||
A logical Z-type operator \$L_z\$ satisfies the | ||
following two conditions: | ||
1. \$L_z \\in \\ker(H_x)\$ | ||
2. \$L_z \\notin \\text{Im}(H_z^T)\$ | ||
""" | ||
function get_logicals(hx, hz) | ||
m = size(copy(hx)',1) | ||
ker_hx = (gf2_row_echelon_with_pivots!(copy(hx)')[3])[gf2_row_echelon_with_pivots!(copy(hx)')[2]+1:m, :] # nullspace | ||
im_hzT = copy(hz)[gf2_row_echelon_with_pivots!(copy(hz)')[4],:] # row-basis | ||
log_stack = vcat(im_hzT, ker_hx) | ||
log_stackT = log_stack' | ||
pivots = gf2_row_echelon_with_pivots!(copy(log_stackT))[4] | ||
r1 = size(copy(im_hzT),1) | ||
r2 = size(copy(log_stack),1) | ||
log_op_indices = [i for i in r1+1:r2 if i in copy(pivots)] | ||
log_ops = copy(log_stack)[log_op_indices, :] | ||
SparseMatrixCSC{Int, Int}(log_ops) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters