Open richardvancouver opened 5 years ago
Hello, Rui.
H
is the set of stabilizer generators for a given code (really, only the toric code is tested well here). The stabilizer is expressed as a binary matrix, hence the choice of the name H (the typical name for the parity check matrix in a classical binary code).
E
is the operators corresponding to logical operations. "Measuring" them tells you whether a logical error has occurred.
For instance, see how they are used in a binary matrix multiplication in https://github.com/Krastanov/neural-decoder/blob/master/neural.py#L37 and https://github.com/Krastanov/neural-decoder/blob/master/neural.py#L43 to calculate the syndrome (stabilizer measurements) and errors (logical operator measurements).
Let me know if you have additional questions.
Hello, Krastanov. Thank you for your answers! Thus after the block diagonalization, H's diagonals are the stabilizer generators. What is flatXflips2Zstab ? How an X flip on a site influences its neighboring Z stabilizers? Thank you!
Best, R.Yang
The particular code implemented in those lines (toric code) is a CSS code, so the checks contain either only X operations or only Z operations (i.e. H is block-diagonal matrix). flatXflips2Zstab
is one of these blocks (the one that detects flips on the X axis, i.e. changes of the Z eigenvalue (an X error commutes with the stabilizers that have X operators and is only detected by the stabilizers that involve Z operators)).
P.S. It is called "flat" because we are forgetting about the 2D structure of the code and just look at its list of stabilizer generators. "Xflip" because it detects X errors. "Zstab" because X errors cause changes of the Z eigenvalues.
Hello, Krastanov! Could you show me the formula(in terms of the matrix multiplication) for the calculation of the fractions of e.g. non-trivial stabilizers, based on H and E? H and E can be used to calculate the fractions of all kinds of stabilizers and logic errors,:
def non_triv_stab_expanded(self, y_true, y_pred):
"Whether the stabilizer after correction is not trivial."
if self.p:
y_pred = undo_normcentererr(y_pred, self.p)
y_true = undo_normcentererr(y_true, self.p)
return K.any(K.dot(self.H, K.transpose((K.round(y_pred)+y_true)%2))%2, axis=0)
def triv_stab(self, y_true, y_pred): "Fraction trivial stabilizer after corrections." return 1-K.mean(F(self.non_triv_stab_expanded(y_true, y_pred)))
Thank you very much!
Best, R.Yang
dot(H,array_of_states)%2
would give you an array with zeros for trivial stabilizer generator measurements and one for tripped stabilizer generators. Above it is in the return statement of the function. Depending on how you calculate the current state array_of_states
would be different. Above, for instance, I am comparing the known true state y_true
from the training data and round(y_pred)
from the model prediction.
I see, is H the parity check matrix from the classical linear codes? Any reference talking about this matrix in QECC? Thank you~
Best, R.Yang
The Nielsen and Chuang textbook covers this, as well as Preskill's lecture notes. Some other references:
@article{mackay2004sparse,
title={Sparse-graph codes for quantum error correction},
author={MacKay, David JC and Mitchison, Graeme and McFadden, Paul L},
journal={IEEE Transactions on Information Theory},
volume={50},
number={10},
pages={2315--2330},
year={2004},
publisher={IEEE}
}
@article{calderbank1998quantum,
title={Quantum error correction via codes over GF (4)},
author={Calderbank, A Robert and Rains, Eric M and Shor, PM and Sloane, Neil JA},
journal={IEEE Transactions on Information Theory},
volume={44},
number={4},
pages={1369--1387},
year={1998},
publisher={IEEE}
}
@inproceedings{steane2007tutorial,
title={A tutorial on quantum error correction},
author={Steane, Andrew M},
booktitle={PROCEEDINGS-INTERNATIONAL SCHOOL OF PHYSICS ENRICO FERMI},
volume={162},
pages={1},
year={2007},
organization={IOS Press; Ohmsha; 1999}
}
@article{gottesman1997stabilizer,
title={Stabilizer codes and quantum error correction},
author={Gottesman, Daniel},
journal={arXiv preprint quant-ph/9705052},
year={1997}
}
The H matrix is indeed the matrix you get if you view the quantum error correcting code as a classical one, by viewing each qubit as two classical bits (one tracking X flips and the other one tracking Z flips).
Hi Krastanov, in the Toric code, can you explain why in your parity check matrix, for each stabilizer, the vertex/plaquette only looks at 2 qubits and not 4? (all the adjacent/touching ones?) Thanks!
Here is the loop that creates the X or Z part of the check matrix: https://github.com/Krastanov/neural-decoder/blob/master/codes.py#L55 - each operator involves 4 columns (4 four assignments inside of the loop). Do you see a mistake somewhere?
Apologies, you are right! I assumed the transposed representation of H. Thanks for the swift reply, all good! :)
Hello, Krastanov! What is the H and E in your codes.py ? Is H related to the Hamiltonian of the toric code?
Best, R.Yang