How this calculation works
Commuting Hermitian Pauli operators specify simultaneous plus-one constraints on n qubits. If their independent rank is r and they do not generate minus identity, the code space has dimension two to the n minus r. The number of logical qubits is n minus r.
Parse signed HermitianPaulis as phase-aware operators. Requirepairwisecommutation; eliminate symplecticrows trackingphases to detect−I and dependency. Let independentrankr, k=n−r. Enumeratenormalizer symplecticvectors commutingwithgenerators; distance=minweight N(S)\S whenk>0. Stabilizerstatek0has no logicaldistance underthisdefinition. Choose2klogicalcosetgeneratorsusing symplectic GramSchmidt, verify pairings and full span. Do not include stabilizer elements in minimumlogicaldistance.A worked example
With the prefilled inputs, distance = 3. Use signed strings e.g. XZZXI or -ZZIII; phase-aware Hermitian commuting stabilizers.
Good to know
Distance minimizes normalizer Pauli weight outside the stabilizer,ignoring global sign. Dependent+I relations accepted;−I rejected. Small exact exhaustive Pauli search.
Reference: Primary method reference or author-maintained documentation (opens in a new tab) ↗
A stabilizer code is a common eigenspace
Commuting Hermitian Pauli operators specify simultaneous plus-one constraints on n qubits. If their independent rank is r and they do not generate minus identity, the code space has dimension two to the n minus r. The number of logical qubits is n minus r.
Signs matter. Two lists with the same unsigned X and Z patterns can define different eigenspaces, and a list generating minus identity defines no state at all. The parser and elimination routine must retain Pauli phases instead of treating generators as unsigned binary rows.
Compare with the Linear error correcting code distance and weight enumerator calculator. Analyze commuting binary symplectic Pauli generators, logicaloperatorquotient and quantumdistance; classical Hammingcode rowspaces do not impose symplectic commutation.
Check commutation before computing a dimension
Use signed strings e.g. XZZXI or -ZZIII; phase-aware Hermitian commuting stabilizers.Represent each Pauli by its X mask, Z mask and phase convention. Two operators commute exactly when their binary symplectic product vanishes. Pairwise checks should identify an offending generator pair rather than returning a dimension for an inconsistent anticommuting constraint set.
Dependent checks are permitted only with phase-aware consistency handling. Repeating a positive generator does not reduce the space again, whereas including both an operator and its negative creates a contradiction. Rank alone cannot distinguish these cases without the associated phases.
Logical operators live in a quotient
Operators commuting with every stabilizer preserve the code space and form the Pauli normalizer. Stabilizer elements act trivially on encoded information, so logical operators are represented by the normalizer modulo the stabilizer. The distance minimizes weight among nontrivial logical cosets.
Choose logical X and Z representatives with the required symplectic pairings. They should commute with all checks, anticommute within each logical pair and commute across distinct pairs. Simply selecting independent normalizer rows does not ensure this canonical logical pairing structure.
The three-qubit repetition checks have distance one
Take generators ZZI and IZZ. They are independent and commute, so three physical qubits encode one logical qubit. XXX commutes with both checks and can serve as logical X. ZII also commutes with both and can serve as logical Z.
The two logical representatives anticommute, as required. ZII has weight one and is not generated by the two weight-two Z checks, so the code distance is one. Calling this a distance-three general quantum code would confuse bit-flip protection with protection against every Pauli error.
Show physical checks and logical pairings
A static diagram should label physical qubit columns and the Pauli letter in each generator row. Separate rows for the selected logical operators reveal their support and make the weight-one logical-Z obstruction obvious. Phase signs should remain visible in text.
The result reports independent stabilizer rank, logical-qubit count, a minimum logical Pauli and paired logical representatives. It does not expose the internal binary masks, full normalizer enumeration or a complete symplectic pairing matrix. Readers can still verify the displayed Pauli strings directly by counting their anticommuting positions and checking the selected minimum-weight witness.
Degenerate checks are not logical errors
A low-weight stabilizer element is not a nontrivial logical error and must be excluded when computing distance. Minimizing over all nonidentity commuting Paulis would therefore underestimate the distance of degenerate codes. Membership in the stabilizer span is an essential second test.
When the code encodes no logical qubits, the normalizer quotient has no nontrivial logical Pauli. Under this page's definition, the usual logical-distance minimum is not defined. Return that status explicitly instead of inventing distance zero or physical length n as a universal answer.
Keep exhaustive enumeration within its stated scope
At the proposed eight-qubit limit, enumerating unsigned Pauli masks is finite, but every candidate still needs exact symplectic and membership tests. The result is an algebraic code calculation; it does not simulate a noisy device or certify fault-tolerant performance under a particular channel.
Regression tests should include inconsistent signs, anticommuting checks, redundant generators, a Bell stabilizer state and a known nondegenerate code. These examples separate phase correctness, rank, logical pairing and distance rather than allowing one successful dimension formula to stand in for all of them. The public prefill is the five-qubit code with four listed stabilizer checks and a returned distance of three. It is intentionally different from the three-qubit repetition example, whose distance is one. Both encode one logical qubit, but that shared dimension must not be used to transfer a distance value or logical-operator witness between them. Distance minimizes normalizer Pauli weight outside the stabilizer,ignoring global sign. Dependent+I relations accepted;−I rejected. Small exact exhaustive Pauli search.
A few questions, answered
Does the repetition example have quantum distance three?
No. It detects certain bit flips, but a weight-one Z operator is a nontrivial logical operation, so its general Pauli distance is one.
Can generator signs be discarded?
No. Opposite signs can make constraints inconsistent even when the unsigned binary rank is unchanged.
Why exclude stabilizer operators from distance?
They act trivially on the encoded information. Distance concerns normalizer operators with nontrivial logical action.
What if no logical qubits are encoded?
The nontrivial-logical-operator distance minimum is undefined under this convention and should be reported explicitly.