Details on check matrix operations
Basic features of check matrix
- All action on state can be represented as operations on check matrix.
- QuantumLegos which don't connect each other are represented by block diagonal check matrix.
Thus, one needs only one check matrix to represent state.
- Generated group from generators represented by check matrix is invariant under row-swap and row-multiplying transforms on the check matrix.
Thus, one can freely perform these row operations on check matrices.
Construction of check matrices and retrieving features
Use CheckMatrix
from Matrix{Bool}
and checkmatrix
from Vector{PauliOp}
.
QuantumLegos.CheckMatrix
— TypeCheckMatrix
Fields
cmat
: matrix itself (matrix ofBool
since we consider only pauli ops.)nlegs
: number of columns ÷ 2ngens
: number of rows
Constructor
CheckMatrix(cmat::AbstractMatrix{Bool})
See also checkmatrix
.
QuantumLegos.checkmatrix
— Functioncheckmatrix(stbgens::AbstractVector{T})::CheckMatrix where {T <: PauliOp}
Get CheckMatrix
from stabilizer generator.
Get xpart and zpart of check matrix.
QuantumLegos.xpart
— Functionxpart(cmat::CheckMatrix)
Get X part (left half) of CheckMatrix.
QuantumLegos.zpart
— Functionzpart(cmat::CheckMatrix)
Get Z part (right half) of CheckMatrix.
Get generators from check matrix with generators
.
QuantumLegos.generators
— Functiongenerators(cmat::CheckMatrix)::Vector{PauliOp}
Get generators from CheckMatrix
.
See also, GeneratedPauliGroup
and Base.Set
to get group generated by generators.
Direct sum
Used when adding lego without edge.
QuantumLegos.direct_sum
— Functiondirect_sum(cmat_1::T, cmat_2::T)::T where {T <: CheckMatrix}
Returns block diagonal CheckMatrix
consists of cmat_1
and cmat_2
.
CheckMatrix transform
When adding a lego $l$ with check matrix $H_l$ to a state with check matrix $H_s$, the resulting check matrix of the state will be
\[\begin{pmatrix} +
Details on check matrix operations
Basic features of check matrix
- All action on state can be represented as operations on check matrix.
- QuantumLegos which don't connect each other are represented by block diagonal check matrix.
Thus, one needs only one check matrix to represent state.
- Generated group from generators represented by check matrix is invariant under row-swap and row-multiplying transforms on the check matrix.
Thus, one can freely perform these row operations on check matrices.
Construction of check matrices and retrieving features
Use CheckMatrix
from Matrix{Bool}
and checkmatrix
from Vector{PauliOp}
.
QuantumLegos.CheckMatrix
— TypeCheckMatrix
Fields
cmat
: matrix itself (matrix ofBool
since we consider only pauli ops.)nlegs
: number of columns ÷ 2ngens
: number of rows
Constructor
CheckMatrix(cmat::AbstractMatrix{Bool})
See also checkmatrix
.
QuantumLegos.checkmatrix
— Functioncheckmatrix(stbgens::AbstractVector{T})::CheckMatrix where {T <: PauliOp}
Get CheckMatrix
from stabilizer generator.
Get xpart and zpart of check matrix.
QuantumLegos.xpart
— Functionxpart(cmat::CheckMatrix)
Get X part (left half) of CheckMatrix.
QuantumLegos.zpart
— Functionzpart(cmat::CheckMatrix)
Get Z part (right half) of CheckMatrix.
Get generators from check matrix with generators
.
QuantumLegos.generators
— Functiongenerators(cmat::CheckMatrix)::Vector{PauliOp}
Get generators from CheckMatrix
.
See also, GeneratedPauliGroup
and Base.Set
to get group generated by generators.
Direct sum
Used when adding lego without edge.
QuantumLegos.direct_sum
— Functiondirect_sum(cmat_1::T, cmat_2::T)::T where {T <: CheckMatrix}
Returns block diagonal CheckMatrix
consists of cmat_1
and cmat_2
.
CheckMatrix transform
When adding a lego $l$ with check matrix $H_l$ to a state with check matrix $H_s$, the resulting check matrix of the state will be
\[\begin{pmatrix} H_s & O \\ O & H_l \\ -\end{pmatrix}\]
Self-tracing
self-tracing
QuantumLegos.self_trace!
— Functionself_trace!(cmat::CheckMatrix, col_1::Integer, col_2::Integer)
Take a self-trace of checkmatrix cmat
with column col_1
and col_2
.
Example
TODO
During self-tracing, pre-formatting and post-formatting described below is performed.
pre-formatting
QuantumLegos.eliminate_column!
— Functioneliminate_column!(
+\end{pmatrix}\]
Self-tracing
self-tracing
QuantumLegos.self_trace!
— Functionself_trace!(cmat::CheckMatrix, col_1::Integer, col_2::Integer)
Take a self-trace of checkmatrix cmat
with column col_1
and col_2
.
Example
TODO
During self-tracing, pre-formatting and post-formatting described below is performed.
pre-formatting
QuantumLegos.eliminate_column!
— Functioneliminate_column!(
cmat::CheckMatrix,
col::Integer,
avoid_row::AbstractVector{T},
@@ -17,9 +17,9 @@ julia> QuantumLegos.eliminate_column!(ex_cmat, 1, Int64[])
julia> ex_cmat
CheckMatrix with 2 generators, 2 legs:
1 0 | 1 0
- 0 1 | 0 1
eliminate_column!(cmat::CheckMatrix, col::Integer,
-avoid_row::AbstractVector{T}) where {T <: Union{Nothing, Integer}}
avoid_row
can include Nothing
, which is ignored in actual evaluation.
QuantumLegos.align_row!
— Functionalign_row!(m::AbstractMatrix, row::Integer, occupied::Vector{Union{Nothing, Integer}}) -> Integer
-align_row!(m::AbstractMatrix, row::Nothing, occupied::Vector{Union{Nothing, Integer}}) -> Nothing
Swap row at row
in m
and row at next to the maximum in occupied
. occupied
is supposed to be a list of returns from eliminate_column!
. If row
is in occupied
, do nothing and returns row
. If row
is nothing
, return nothing
.
Arguments
m::AbstractMatrix
: mutatedrow::Union{Nothing, Integer}
: row to be alignedoccupied::Vector{Union{Nothing, Integer}}
: indices of already occupied rows.row
will be next to these rows.
Return
- Row index where
row
is moved.
By this process, all columns to be traced have 1
s on only 1st to 4th rows. So during QuantumLegos.self_trace!
, all stabilizers generated from top three rows are calculated and perform operator matching.
post-formatting
Remove rows which are linear combinations of other rows.
QuantumLegos.ref!
— Functionref!(cmat::CheckMatrix) -> Int
Convert cmat
to row echelon form.
Returns rank of check matrix.
Examples
julia> cmat = CheckMatrix(Bool[
+ 0 1 | 0 1
eliminate_column!(cmat::CheckMatrix, col::Integer,
+avoid_row::AbstractVector{T}) where {T <: Union{Nothing, Integer}}
avoid_row
can include Nothing
, which is ignored in actual evaluation.
QuantumLegos.align_row!
— Functionalign_row!(m::AbstractMatrix, row::Integer, occupied::Vector{Union{Nothing, Integer}}) -> Integer
+align_row!(m::AbstractMatrix, row::Nothing, occupied::Vector{Union{Nothing, Integer}}) -> Nothing
Swap row at row
in m
and row at next to the maximum in occupied
. occupied
is supposed to be a list of returns from eliminate_column!
. If row
is in occupied
, do nothing and returns row
. If row
is nothing
, return nothing
.
Arguments
m::AbstractMatrix
: mutatedrow::Union{Nothing, Integer}
: row to be alignedoccupied::Vector{Union{Nothing, Integer}}
: indices of already occupied rows.row
will be next to these rows.
Return
- Row index where
row
is moved.
By this process, all columns to be traced have 1
s on only 1st to 4th rows. So during QuantumLegos.self_trace!
, all stabilizers generated from top three rows are calculated and perform operator matching.
post-formatting
Remove rows which are linear combinations of other rows.
QuantumLegos.ref!
— Functionref!(cmat::CheckMatrix) -> Int
Convert cmat
to row echelon form.
Returns rank of check matrix.
Examples
julia> cmat = CheckMatrix(Bool[
1 0 1 0 1 1 0 1
0 1 0 0 0 1 0 0
1 1 1 0 1 0 1 1
@@ -41,4 +41,4 @@ CheckMatrix with 4 generators, 4 legs:
0 1 0 0 | 0 1 0 0
0 0 0 0 | 0 0 1 0
0 0 0 0 | 0 0 0 0
-
QuantumLegos.eliminate_dependent_row!
— Functioneliminate_dependent_row!(cmat::CheckMatrix) -> CheckMatrix
Remove dependent rows to keep only independent generators.
Settings
This document was generated with Documenter.jl version 1.4.1 on Tuesday 7 May 2024. Using Julia version 1.10.3.
QuantumLegos.eliminate_dependent_row!
— Functioneliminate_dependent_row!(cmat::CheckMatrix) -> CheckMatrix
Remove dependent rows to keep only independent generators.