Qrack
1.7
General classical-emulating-quantum development framework
|
Functions | |
virtual void | Qrack::QInterface::ApplySingleBit (const complex *mtrx, bool doCalcNorm, bitLenInt qubitIndex) |
Apply an arbitrary single bit unitary transformation. More... | |
virtual void | Qrack::QInterface::CCNOT (bitLenInt control1, bitLenInt control2, bitLenInt target) |
Doubly-controlled NOT gate. More... | |
virtual void | Qrack::QInterface::AntiCCNOT (bitLenInt control1, bitLenInt control2, bitLenInt target) |
Anti doubly-controlled NOT gate. More... | |
virtual void | Qrack::QInterface::CNOT (bitLenInt control, bitLenInt target) |
Controlled NOT gate. More... | |
virtual void | Qrack::QInterface::AntiCNOT (bitLenInt control, bitLenInt target) |
Anti controlled NOT gate. More... | |
virtual void | Qrack::QInterface::H (bitLenInt qubitIndex) |
Hadamard gate. More... | |
virtual bool | Qrack::QInterface::M (bitLenInt qubitIndex) |
Measurement gate. More... | |
virtual void | Qrack::QInterface::X (bitLenInt qubitIndex) |
X gate. More... | |
virtual void | Qrack::QInterface::Y (bitLenInt qubitIndex) |
Y gate. More... | |
virtual void | Qrack::QInterface::Z (bitLenInt qubitIndex) |
Z gate. More... | |
virtual void | Qrack::QInterface::CY (bitLenInt control, bitLenInt target) |
Controlled Y gate. More... | |
virtual void | Qrack::QInterface::CZ (bitLenInt control, bitLenInt target) |
Controlled Z gate. More... | |
virtual void | Qrack::QUnit::ApplySingleBit (const complex *mtrx, bool doCalcNorm, bitLenInt qubit) |
Apply an arbitrary single bit unitary transformation. More... | |
virtual void | Qrack::QUnit::CCNOT (bitLenInt control1, bitLenInt control2, bitLenInt target) |
Doubly-controlled NOT gate. More... | |
virtual void | Qrack::QUnit::AntiCCNOT (bitLenInt control1, bitLenInt control2, bitLenInt target) |
Anti doubly-controlled NOT gate. More... | |
virtual void | Qrack::QUnit::CNOT (bitLenInt control, bitLenInt target) |
Controlled NOT gate. More... | |
virtual void | Qrack::QUnit::AntiCNOT (bitLenInt control, bitLenInt target) |
Anti controlled NOT gate. More... | |
virtual void | Qrack::QUnit::H (bitLenInt qubit) |
Hadamard gate. More... | |
virtual bool | Qrack::QUnit::M (bitLenInt qubit) |
Measure a bit. More... | |
virtual void | Qrack::QUnit::X (bitLenInt qubit) |
X gate. More... | |
virtual void | Qrack::QUnit::Y (bitLenInt qubit) |
Y gate. More... | |
virtual void | Qrack::QUnit::Z (bitLenInt qubit) |
Z gate. More... | |
virtual void | Qrack::QUnit::CY (bitLenInt control, bitLenInt target) |
Controlled Y gate. More... | |
virtual void | Qrack::QUnit::CZ (bitLenInt control, bitLenInt target) |
Controlled Z gate. More... | |
Anti doubly-controlled NOT gate.
"Anti-doubly-controlled not" - Apply "not" if control bits are both zero, do not apply if either control bit is one.
If both controls are set to 0, the target bit is NOT-ed or X-ed.
Reimplemented from Qrack::QInterface.
|
virtual |
Anti doubly-controlled NOT gate.
"Anti-doubly-controlled not" - Apply "not" if control bits are both zero, do not apply if either control bit is one.
If both controls are set to 0, the target bit is NOT-ed or X-ed.
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
Anti controlled NOT gate.
"Anti-controlled not" - Apply "not" if control bit is zero, do not apply if control bit is one.
If the control is set to 0, the target bit is NOT-ed or X-ed.
Reimplemented from Qrack::QInterface.
Anti controlled NOT gate.
"Anti-controlled not" - Apply "not" if control bit is zero, do not apply if control bit is one.
If the control is set to 0, the target bit is NOT-ed or X-ed.
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
|
virtual |
Apply an arbitrary single bit unitary transformation.
If float rounding from the application of the matrix might change the state vector norm, "doCalcNorm" should be set to true.
Reimplemented from Qrack::QInterface.
|
virtual |
Apply an arbitrary single bit unitary transformation.
If float rounding from the application of the matrix might change the state vector norm, "doCalcNorm" should be set to true.
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
Doubly-controlled NOT gate.
Doubly-controlled not.
If both controls are set to 1, the target bit is NOT-ed or X-ed.
Reimplemented from Qrack::QInterface.
Doubly-controlled NOT gate.
Doubly-controlled not.
If both controls are set to 1, the target bit is NOT-ed or X-ed.
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
Controlled NOT gate.
Controlled not.
If the control is set to 1, the target bit is NOT-ed or X-ed.
Reimplemented from Qrack::QInterface.
Controlled NOT gate.
Controlled not.
If the control is set to 1, the target bit is NOT-ed or X-ed.
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
Controlled Y gate.
Apply controlled Pauli Y matrix to bit.
If the "control" bit is set to 1, then the Pauli "Y" operator is applied to "target."
Reimplemented from Qrack::QInterface.
Controlled Y gate.
Apply controlled Pauli Y matrix to bit.
If the "control" bit is set to 1, then the Pauli "Y" operator is applied to "target."
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
Controlled Z gate.
Apply controlled Pauli Z matrix to bit.
If the "control" bit is set to 1, then the Pauli "Z" operator is applied to "target."
Reimplemented from Qrack::QInterface.
Controlled Z gate.
Apply controlled Pauli Z matrix to bit.
If the "control" bit is set to 1, then the Pauli "Z" operator is applied to "target."
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
|
virtual |
Hadamard gate.
Applies a Hadamard gate on qubit at "qubitIndex."
Reimplemented from Qrack::QInterface.
|
virtual |
Hadamard gate.
Applies a Hadamard gate on qubit at "qubitIndex."
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
|
virtual |
Measure a bit.
Reimplemented from Qrack::QInterface.
|
virtual |
Measurement gate.
Measures the qubit at "qubitIndex" and returns either "true" or "false." (This "gate" breaks unitarity.)
All physical evolution of a quantum state should be "unitary," except measurement. Measurement of a qubit "collapses" the quantum state into either only permutation states consistent with a |0> state for the bit, or else only permutation states consistent with a |1> state for the bit. Measurement also effectively multiplies the overall quantum state vector of the system by a random phase factor, equiprobable over all possible phase angles.
Effectively, when a bit measurement is emulated, Qrack calculates the norm of all permutation state components, to find their respective probabilities. The probabilities of all states in which the measured bit is "0" can be summed to give the probability of the bit being "0," and separately the probabilities of all states in which the measured bit is "1" can be summed to give the probability of the bit being "1." To simulate measurement, a random float between 0 and 1 is compared to the sum of the probability of all permutation states in which the bit is equal to "1". Depending on whether the random float is higher or lower than the probability, the qubit is determined to be either |0> or |1>, (up to phase). If the bit is determined to be |1>, then all permutation eigenstates in which the bit would be equal to |0> have their probability set to zero, and vice versa if the bit is determined to be |0>. Then, all remaining permutation states with nonzero probability are linearly rescaled so that the total probability of all permutation states is again "normalized" to exactly 100% or 1, (within double precision rounding error). Physically, the act of measurement should introduce an overall random phase factor on the state vector, which is emulated by generating another constantly distributed random float to select a phase angle between 0 and 2 * Pi.
Measurement breaks unitary evolution of state. All quantum gates except measurement should generally act as a unitary matrix on a permutation state vector. (Note that Boolean comparison convenience methods in Qrack such as "AND," "OR," and "XOR" employ the measurement operation in the act of first clearing output bits before filling them with the result of comparison, and these convenience methods therefore break unitary evolution of state, but in a physically realistic way. Comparable unitary operations would be performed with a combination of X and CCNOT gates, also called "Toffoli" gates, but the output bits would have to be assumed to be in a known fixed state, like all |0>, ahead of time to produce unitary logical comparison operations.)
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
|
virtual |
X gate.
NOT gate, which is also Pauli x matrix.
Applies the Pauli "X" operator to the qubit at "qubitIndex." The Pauli "X" operator is equivalent to a logical "NOT."
Reimplemented from Qrack::QInterface.
|
virtual |
X gate.
NOT gate, which is also Pauli x matrix.
Applies the Pauli "X" operator to the qubit at "qubitIndex." The Pauli "X" operator is equivalent to a logical "NOT."
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
|
virtual |
Y gate.
Apply Pauli Y matrix to bit.
Applies the Pauli "Y" operator to the qubit at "qubitIndex." The Pauli "Y" operator is similar to a logical "NOT" with permutation phase effects.
Reimplemented from Qrack::QInterface.
|
virtual |
Y gate.
Apply Pauli Y matrix to bit.
Applies the Pauli "Y" operator to the qubit at "qubitIndex." The Pauli "Y" operator is similar to a logical "NOT" with permutation phase effects.
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.
|
virtual |
Z gate.
Apply Pauli Z matrix to bit.
Applies the Pauli "Z" operator to the qubit at "qubitIndex." The Pauli "Z" operator reverses the phase of |1> and leaves |0> unchanged.
Reimplemented from Qrack::QInterface.
|
virtual |
Z gate.
Apply Pauli Z matrix to bit.
Applies the Pauli "Z" operator to the qubit at "qubitIndex." The Pauli "Z" operator reverses the phase of |1> and leaves |0> unchanged.
Reimplemented in Qrack::QEngineOCLMulti, and Qrack::QUnit.