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.CheckMatrixType

CheckMatrix

Fields

  • cmat: matrix itself (matrix of Bool since we consider only pauli ops.)
  • nlegs: number of columns ÷ 2
  • ngens: number of rows

Constructor

CheckMatrix(cmat::AbstractMatrix{Bool})

See also checkmatrix.

source

Get xpart and zpart of check matrix.

Get generators from check matrix with generators.

See also, GeneratedPauliGroup and Base.Set to get group generated by generators.

Direct sum

Used when adding lego without edge.

QuantumLegos.direct_sumFunction
direct_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}\]

source

Self-tracing

self-tracing

QuantumLegos.self_trace!Function
self_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

source

During self-tracing, pre-formatting and post-formatting described below is performed.

pre-formatting

QuantumLegos.eliminate_column!Function
eliminate_column!(
    cmat::CheckMatrix,
    col::Integer,
    avoid_row::AbstractVector{T},
)::Union{Nothing, Int64} where {T <: Integer}

Perform Gauss Elimination on col. Keep only one 1 on col and remove from other rows by performing multiplication. Choose row not in avoid_row. If all rows with 1 on col are in avoid_row, then the last row of them is chose to keep 1. If all rows on col is 0, return nothing.

Return

Row index which have 1 on col. If all row on col is 0, return nothing.

Example

julia> ex_cmat = CheckMatrix(Bool[1 0 1 0; 1 1 1 1])
CheckMatrix with 2 generators, 2 legs:
  1  0 | 1  0
  1  1 | 1  1

julia> QuantumLegos.eliminate_column!(ex_cmat, 1, Int64[])
1

julia> ex_cmat
CheckMatrix with 2 generators, 2 legs:
  1  0 | 1  0
  0  1 | 0  1
source
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.

source
QuantumLegos.align_row!Function
align_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: mutated
  • row::Union{Nothing, Integer}: row to be aligned
  • occupied::Vector{Union{Nothing, Integer}}: indices of already occupied rows. row will be next to these rows.

Return

  • Row index where row is moved.
source

QuantumLegos.align_row!

By this process, all columns to be traced have 1s 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!Function
ref!(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
           0 1 0 0 0 1 0 0
       ])
CheckMatrix with 4 generators, 4 legs:
  1  0  1  0 | 1  1  0  1
  0  1  0  0 | 0  1  0  0
  1  1  1  0 | 1  0  1  1
  0  1  0  0 | 0  1  0  0


julia> QuantumLegos.ref!(cmat)
3

julia> cmat
CheckMatrix with 4 generators, 4 legs:
  1  0  1  0 | 1  1  0  1
  0  1  0  0 | 0  1  0  0
  0  0  0  0 | 0  0  1  0
  0  0  0  0 | 0  0  0  0
source