TNDecode module

TensorNetworkCodes.TNDecode.mps_contractFunction
mps_contract(bond_dim=10) -> function

Return a contract function for use with tn_decode that contracts a matrix of ITensor, treating rows as MPS/MPO and contracting rows element-wise, retaining a maximum bond dimension of bond_dim, before contracting along the final row.

See also: tn_decode.

source
TensorNetworkCodes.TNDecode.tn_decodeFunction
tn_decode(
    code::TensorNetworkCode, syndrome::AbstractVector{Int}, error_probability::Real;
    contract_fn=basic_contract()
) -> (Vector{Int}, Float64)

Return a recovery operator for the code, that is consistent with the syndrome and is from the most-likely logical coset. Additionally, the predicted success probability, defined as the ratio of the probability of the mostly-likely logical coset to the sum of the probabilities of all logical cosets, is returned.

The method of tensor-network contraction defaults to basic_contract, which corresponds to exact contraction. Alternatively, mps_contract may be specified for efficient but approximate contraction.

See also: basic_contract, mps_contract

Note

This function currently assumes a depolarizing noise model and only supports codes that can be laid out on a square lattice.

Examples

julia> using TensorNetworkCodes.TNDecode

julia> code = rotated_surface_code(3);

julia> error = [0, 0, 0, 1, 0, 0, 3, 0, 0];  # IIIXIIZII

julia> syndrome = find_syndrome(code, error);

julia> p = 0.2;  # error_probability

julia> recovery, success_prob = tn_decode(code, syndrome, p; contract_fn=mps_contract(8))
([0, 0, 0, 3, 3, 0, 1, 3, 0], 0.8250539267483997)

julia> find_syndrome(code, recovery) == syndrome
true
source