scalerqec.Symbolic package

Submodules

scalerqec.Symbolic.symbolic module

scalerqec.Symbolic.symbolic.binom(k)[source]
scalerqec.Symbolic.symbolic.calculate_LER(error_row_indices)[source]
scalerqec.Symbolic.symbolic.idx_to_vec(idx)[source]
scalerqec.Symbolic.symbolic.print_table(i, j)[source]
scalerqec.Symbolic.symbolic.vec_to_idx(vec)[source]
scalerqec.Symbolic.symbolic.verity_table(i)[source]
scalerqec.Symbolic.symbolic.xor_vec(a, b)[source]

scalerqec.Symbolic.symbolicLER module

scalerqec.Symbolic.symbolicLER.MAX_weight = 12

Use symbolic algorithm to calculate the probability. Simply enumerate all possible cases

scalerqec.Symbolic.symbolicLER.idx_to_bool_list(idx, dimension)[source]

Converts and integer index back to the boolean vector of a given dimension. The first element of the vector is the most significant bit (MSB). Example: (5,3) - > [True,False,True]

Parameters:
  • idx – The non-negative integer index.

  • dimension – The desired non-negative dimension(length) of the output binary vector

Returns:

A list of boolean representing the binary digits given the index.

scalerqec.Symbolic.symbolicLER.idx_to_vec(idx, dimension)[source]

Converts and integer index back to the binary vector of a given dimension. The first element of the vector is the most significant bit (MSB). Example: (5,3) - > (1,0,1)

Parameters:
  • idx – The non-negative integer index.

  • dimension – The desired non-negative dimension(length) of the output binary vector

Returns:

A tuple of binary digits representing the index.

class scalerqec.Symbolic.symbolicLER.symbolicLER(error_rate=0)[source]

Bases: object

calculate_LER_from_StabCode(qeccirc: StabCode, noise_model: NoiseModel) float[source]

Given a StabCode object, calculate the LER polynomial symbolically

Parameters:
  • qeccirc – A StabCode object

  • error_rate – The physical error rate

Returns:

The symbolic polynomial of LER

calc_error_row_indices()[source]

Based on the prediction result by pymatching of all possible input, build a list including all row indices that cause logical error

calculate_LER()[source]
calculate_LER_brute_force()[source]

Enumerate all possible noise input to get the exact LER polynomial

calculate_LER_from_file(filepath, pvalue) float[source]

The most import function. Read the stim circuit, calculate the exact polynomial of LER, and evaluate with the value of p(physical error rate).

Following steps are included:

Step1: Parse the circuit from the file, inject depolarization noise Step2: Compile the STIM detector graph, generate the entire prediction table Stem3: Construct the QEPG graph Step4: Calculate all row indices in the table that will cause logical error Step5: Use dynamic algorithm to calculate the probability of measuring any possible outcomes Step6: Sum up all probability in the row with logical error

Parameters:
  • filepath – The path of the file with the STIM circuit

  • pvalue – The physical error rate

Returns:

A floating value which store the final logical error rate

dynamic_calculation_of_dp()[source]
evaluate_LER(pval)[source]
evaluate_LER_subspace(pval, weight)[source]
generate_pymatching_table()[source]

For all detector result, generate the prediction through pymatching.

_all_predictions store all prediction by matching

get_totalnoise()[source]

Get the total number of noise in the circuit

initialize_dp()[source]

Given the circuit information, initialize the dp table for running the algorithm

initialize_single_pauli_propagation()[source]

Calculate and store the table of the propagation result of single pauli error

parse_from_file(filepath)[source]

Read the circuit, parse from the file

subspace_LER(weight)[source]

Get the subspace LER for a given weight

verify_table(i)[source]
scalerqec.Symbolic.symbolicLER.vec_to_idx(vec)[source]

Converts a binary vector (A tuple or a list of 0s and 1s) to an integer index. The first element of the vector is treated as the most significant bit(MSB). Example: (1,0,1) -> 1*2^2 + 0*2^1 + 1*2^0 =5

Parameters:

vec – A tuple or list of binary digits(0 or 1).

Returns:

An integer representation of the binary vector. Returns 0 for an empty vector.

scalerqec.Symbolic.symbolicLER.xor_vec(vec_a, vec_b)[source]

Performs element-wise XOR addition on two binary vectors.

Parameters:
  • vec_a – The first binary vector (tuple or list of 0s and 1s).

  • vec_b – The second binary vector (tuple or list of 0s and 1s).

Returns:

A tuple representing the element-wise XOR of two vectors.

scalerqec.Symbolic.symbolicNaive module

scalerqec.Symbolic.symbolicNaive.idx_to_vec(idx)[source]
scalerqec.Symbolic.symbolicNaive.pos_int_to_vec(vecidx)[source]
scalerqec.Symbolic.symbolicNaive.vec_to_idx(vec)[source]
scalerqec.Symbolic.symbolicNaive.xor_vec(a, b)[source]

Module contents

class scalerqec.Symbolic.symbolicLER(error_rate=0)[source]

Bases: object

calculate_LER_from_StabCode(qeccirc: StabCode, noise_model: NoiseModel) float[source]

Given a StabCode object, calculate the LER polynomial symbolically

Parameters:
  • qeccirc – A StabCode object

  • error_rate – The physical error rate

Returns:

The symbolic polynomial of LER

calc_error_row_indices()[source]

Based on the prediction result by pymatching of all possible input, build a list including all row indices that cause logical error

calculate_LER()[source]
calculate_LER_brute_force()[source]

Enumerate all possible noise input to get the exact LER polynomial

calculate_LER_from_file(filepath, pvalue) float[source]

The most import function. Read the stim circuit, calculate the exact polynomial of LER, and evaluate with the value of p(physical error rate).

Following steps are included:

Step1: Parse the circuit from the file, inject depolarization noise Step2: Compile the STIM detector graph, generate the entire prediction table Stem3: Construct the QEPG graph Step4: Calculate all row indices in the table that will cause logical error Step5: Use dynamic algorithm to calculate the probability of measuring any possible outcomes Step6: Sum up all probability in the row with logical error

Parameters:
  • filepath – The path of the file with the STIM circuit

  • pvalue – The physical error rate

Returns:

A floating value which store the final logical error rate

dynamic_calculation_of_dp()[source]
evaluate_LER(pval)[source]
evaluate_LER_subspace(pval, weight)[source]
generate_pymatching_table()[source]

For all detector result, generate the prediction through pymatching.

_all_predictions store all prediction by matching

get_totalnoise()[source]

Get the total number of noise in the circuit

initialize_dp()[source]

Given the circuit information, initialize the dp table for running the algorithm

initialize_single_pauli_propagation()[source]

Calculate and store the table of the propagation result of single pauli error

parse_from_file(filepath)[source]

Read the circuit, parse from the file

subspace_LER(weight)[source]

Get the subspace LER for a given weight

verify_table(i)[source]