mimiqcircuits.classical.paritycheck¶
Classes
|
Performs a parity check on N-1 classical bits and stores the result in the first bit. |
- class mimiqcircuits.classical.paritycheck.ParityCheck(N=3)[source]¶
Bases:
AbstractClassicalPerforms a parity check on N-1 classical bits and stores the result in the first bit.
It computes the sum modulo 2 of the inputs.
Examples
>>> from mimiqcircuits import * >>> ParityCheck() c[?0] = ⨊ c[?1, ?2] >>> ParityCheck(5) c[?0] = ⨊ c[?1, ?2, ?3, ?4] >>> c = Circuit() >>> c.push(ParityCheck(), 0, 2, 3) 4-bit circuit with 1 instruction: └── c[0] = ⨊ c[2, 3] >>> c = Circuit() >>> c.push(ParityCheck(5), 0, 1, 2, 3, 4) 5-bit circuit with 1 instruction: └── c[0] = ⨊ c[1, 2, 3, 4]