Example codes

SimpleCode examples

TensorNetworkCodes.random_codeFunction
random_code(n::Int, k::Int) -> SimpleCode

Return a random code with n physical qubits and k logicals qubits.

An ErrorException is raised if k > n.

source

TensorNetworkCode examples

TensorNetworkCodes.almost_rotated_surface_codeFunction
almost_rotated_surface_code(
L::Int64,
input_seed_code::SimpleCode,
input_coords::Array{Int64}) -> TensorNetworkCode

Generates a TensorNetworkCode that is almost the rotated surface code. Requires the input_seed_code to have five qubits and to be in the bulk (input_coords with components not equal to 1 or L).

Examples

julia> code = almost_rotated_surface_code(3,five_qubit_code(),[2,2]);

julia> verify(code) # try this out and check we get a real code
true
source
TensorNetworkCodes.rotated_surface_codeFunction
rotated_surface_code(L::Int64) -> TensorNetworkCode

Generates the LxL rotated surface code as a TensorNetworkCode.

Examples

julia> rot = rotated_surface_code(3);

julia> pauli_weight(rot.stabilizers[2]) # weight of a plaquette stabilizer
4
source
TensorNetworkCodes.surface_codeFunction
surface_code(L::Int64)

Returns an (L+1) x L surface code TensorNetworkCode.

Examples

julia> surf = surface_code(2);

julia> dist = find_distance_logicals(surf)[1] # code distance
3
source