scalerqec.Symbolic package¶
Submodules¶
scalerqec.Symbolic.symbolic module¶
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_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
- generate_pymatching_table()[source]¶
For all detector result, generate the prediction through pymatching.
_all_predictions store all prediction by matching
- initialize_dp()[source]¶
Given the circuit information, initialize the dp table for running the algorithm
- 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¶
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_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
- generate_pymatching_table()[source]¶
For all detector result, generate the prediction through pymatching.
_all_predictions store all prediction by matching
- initialize_dp()[source]¶
Given the circuit information, initialize the dp table for running the algorithm