Qrack  7.0
General classical-emulating-quantum development framework
Functions
Basic quantum gate primitives

Functions

virtual void Qrack::QInterface::Mtrx (const complex *mtrx, bitLenInt qubitIndex)=0
 Apply an arbitrary single bit unitary transformation. More...
 
virtual void Qrack::QInterface::MCMtrx (const bitLenInt *controls, bitLenInt controlLen, const complex *mtrx, bitLenInt target)=0
 Apply an arbitrary single bit unitary transformation, with arbitrary control bits. More...
 
virtual void Qrack::QInterface::MACMtrx (const bitLenInt *controls, bitLenInt controlLen, const complex *mtrx, bitLenInt target)
 Apply an arbitrary single bit unitary transformation, with arbitrary (anti-)control bits. More...
 
virtual void Qrack::QInterface::Phase (const complex topLeft, const complex bottomRight, bitLenInt qubitIndex)
 Apply a single bit transformation that only effects phase. More...
 
virtual void Qrack::QInterface::Invert (const complex topRight, const complex bottomLeft, bitLenInt qubitIndex)
 Apply a single bit transformation that reverses bit probability and might effect phase. More...
 
virtual void Qrack::QInterface::MCPhase (const bitLenInt *controls, bitLenInt controlLen, complex topLeft, complex bottomRight, bitLenInt target)
 Apply a single bit transformation that only effects phase, with arbitrary control bits. More...
 
virtual void Qrack::QInterface::MCInvert (const bitLenInt *controls, bitLenInt controlLen, complex topRight, complex bottomLeft, bitLenInt target)
 Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary control bits. More...
 
virtual void Qrack::QInterface::MACPhase (const bitLenInt *controls, bitLenInt controlLen, complex topLeft, complex bottomRight, bitLenInt target)
 Apply a single bit transformation that only effects phase, with arbitrary (anti-)control bits. More...
 
virtual void Qrack::QInterface::MACInvert (const bitLenInt *controls, bitLenInt controlLen, complex topRight, complex bottomLeft, bitLenInt target)
 Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary (anti-)control bits. More...
 
virtual void Qrack::QInterface::UniformlyControlledSingleBit (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubitIndex, const complex *mtrxs)
 Apply a "uniformly controlled" arbitrary single bit unitary transformation. More...
 
virtual void Qrack::QInterface::UniformlyControlledSingleBit (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubitIndex, const complex *mtrxs, const bitCapInt *mtrxSkipPowers, bitLenInt mtrxSkipLen, bitCapInt mtrxSkipValueMask)
 
virtual void Qrack::QInterface::TimeEvolve (Hamiltonian h, real1_f timeDiff)
 To define a Hamiltonian, give a vector of controlled single bit gates ("HamiltonianOp" instances) that are applied by left-multiplication in low-to-high vector index order on the state vector. More...
 
virtual void Qrack::QInterface::CSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply a swap with arbitrary control bits. More...
 
virtual void Qrack::QInterface::AntiCSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply a swap with arbitrary (anti) control bits. More...
 
virtual void Qrack::QInterface::CSqrtSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply a square root of swap with arbitrary control bits. More...
 
virtual void Qrack::QInterface::AntiCSqrtSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply a square root of swap with arbitrary (anti) control bits. More...
 
virtual void Qrack::QInterface::CISqrtSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply an inverse square root of swap with arbitrary control bits. More...
 
virtual void Qrack::QInterface::AntiCISqrtSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply an inverse square root of swap with arbitrary (anti) control bits. 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::CY (bitLenInt control, bitLenInt target)
 Controlled Y gate. More...
 
virtual void Qrack::QInterface::AntiCY (bitLenInt control, bitLenInt target)
 Anti controlled Y gate. More...
 
virtual void Qrack::QInterface::CCY (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Doubly-Controlled Y gate. More...
 
virtual void Qrack::QInterface::AntiCCY (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Anti doubly-controlled Y gate. More...
 
virtual void Qrack::QInterface::CZ (bitLenInt control, bitLenInt target)
 Controlled Z gate. More...
 
virtual void Qrack::QInterface::AntiCZ (bitLenInt control, bitLenInt target)
 Anti controlled Z gate. More...
 
virtual void Qrack::QInterface::CCZ (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Doubly-Controlled Z gate. More...
 
virtual void Qrack::QInterface::AntiCCZ (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Anti doubly-controlled Z gate. More...
 
virtual void Qrack::QInterface::U (bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
 General unitary gate. More...
 
virtual void Qrack::QInterface::U2 (bitLenInt target, real1_f phi, real1_f lambda)
 2-parameter unitary gate More...
 
virtual void Qrack::QInterface::IU2 (bitLenInt target, real1_f phi, real1_f lambda)
 Inverse 2-parameter unitary gate. More...
 
virtual void Qrack::QInterface::AI (bitLenInt target, real1_f azimuth, real1_f inclination)
 "Azimuth, Inclination" (RY-RZ) More...
 
virtual void Qrack::QInterface::IAI (bitLenInt target, real1_f azimuth, real1_f inclination)
 Invert "Azimuth, Inclination" (RY-RZ) More...
 
virtual void Qrack::QInterface::CU (const bitLenInt *controls, bitLenInt controlLen, bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
 Controlled general unitary gate. More...
 
virtual void Qrack::QInterface::AntiCU (const bitLenInt *controls, bitLenInt controlLen, bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
 (Anti-)Controlled general unitary gate More...
 
virtual void Qrack::QInterface::H (bitLenInt qubitIndex)
 Hadamard gate. More...
 
virtual void Qrack::QInterface::SqrtH (bitLenInt qubitIndex)
 Square root of Hadamard gate. More...
 
virtual void Qrack::QInterface::SH (bitLenInt qubitIndex)
 Y-basis transformation gate. More...
 
virtual void Qrack::QInterface::HIS (bitLenInt qubitIndex)
 Y-basis (inverse) transformation gate. More...
 
virtual bool Qrack::QInterface::M (bitLenInt qubitIndex)
 Measurement gate. More...
 
virtual bool Qrack::QInterface::ForceM (bitLenInt qubit, bool result, bool doForce=true, bool doApply=true)=0
 Act as if is a measurement was applied, except force the (usually random) result. More...
 
virtual void Qrack::QInterface::S (bitLenInt qubitIndex)
 S gate. More...
 
virtual void Qrack::QInterface::IS (bitLenInt qubitIndex)
 Inverse S gate. More...
 
virtual void Qrack::QInterface::T (bitLenInt qubitIndex)
 T gate. More...
 
virtual void Qrack::QInterface::IT (bitLenInt qubitIndex)
 Inverse T gate. More...
 
virtual void Qrack::QInterface::PhaseRootN (bitLenInt n, bitLenInt qubitIndex)
 "PhaseRootN" gate More...
 
virtual void Qrack::QInterface::IPhaseRootN (bitLenInt n, bitLenInt qubitIndex)
 Inverse "PhaseRootN" gate. More...
 
virtual void Qrack::QInterface::PhaseParity (real1_f radians, bitCapInt mask)
 Parity phase gate. More...
 
virtual void Qrack::QInterface::X (bitLenInt qubitIndex)
 X gate. More...
 
virtual void Qrack::QInterface::XMask (bitCapInt mask)
 Masked X gate. More...
 
virtual void Qrack::QInterface::Y (bitLenInt qubitIndex)
 Y gate. More...
 
virtual void Qrack::QInterface::YMask (bitCapInt mask)
 Masked Y gate. More...
 
virtual void Qrack::QInterface::Z (bitLenInt qubitIndex)
 Z gate. More...
 
virtual void Qrack::QInterface::ZMask (bitCapInt mask)
 Masked Z gate. More...
 
virtual void Qrack::QInterface::SqrtX (bitLenInt qubitIndex)
 Square root of X gate. More...
 
virtual void Qrack::QInterface::ISqrtX (bitLenInt qubitIndex)
 Inverse square root of X gate. More...
 
virtual void Qrack::QInterface::SqrtXConjT (bitLenInt qubitIndex)
 Phased square root of X gate. More...
 
virtual void Qrack::QInterface::ISqrtXConjT (bitLenInt qubitIndex)
 Inverse phased square root of X gate. More...
 
virtual void Qrack::QInterface::SqrtY (bitLenInt qubitIndex)
 Square root of Y gate. More...
 
virtual void Qrack::QInterface::ISqrtY (bitLenInt qubitIndex)
 Square root of Y gate. More...
 
virtual void Qrack::QInterface::CH (bitLenInt control, bitLenInt target)
 Controlled H gate. More...
 
virtual void Qrack::QInterface::AntiCH (bitLenInt control, bitLenInt target)
 (Anti-)controlled H gate More...
 
virtual void Qrack::QInterface::CS (bitLenInt control, bitLenInt target)
 Controlled S gate. More...
 
virtual void Qrack::QInterface::AntiCS (bitLenInt control, bitLenInt target)
 (Anti-)controlled S gate More...
 
virtual void Qrack::QInterface::CIS (bitLenInt control, bitLenInt target)
 Controlled inverse S gate. More...
 
virtual void Qrack::QInterface::AntiCIS (bitLenInt control, bitLenInt target)
 (Anti-)controlled inverse S gate More...
 
virtual void Qrack::QInterface::CT (bitLenInt control, bitLenInt target)
 Controlled T gate. More...
 
virtual void Qrack::QInterface::CIT (bitLenInt control, bitLenInt target)
 Controlled inverse T gate. More...
 
virtual void Qrack::QInterface::CPhaseRootN (bitLenInt n, bitLenInt control, bitLenInt target)
 Controlled "PhaseRootN" gate. More...
 
virtual void Qrack::QInterface::AntiCPhaseRootN (bitLenInt n, bitLenInt control, bitLenInt target)
 (Anti-)controlled "PhaseRootN" gate More...
 
virtual void Qrack::QInterface::CIPhaseRootN (bitLenInt n, bitLenInt control, bitLenInt target)
 Controlled inverse "PhaseRootN" gate. More...
 
virtual void Qrack::QInterface::AntiCIPhaseRootN (bitLenInt n, bitLenInt control, bitLenInt target)
 (Anti-)controlled inverse "PhaseRootN" gate More...
 
virtual void Qrack::QUnit::H (bitLenInt target)
 Hadamard gate. More...
 
virtual void Qrack::QUnit::S (bitLenInt target)
 S gate. More...
 
virtual void Qrack::QUnit::IS (bitLenInt target)
 Inverse S gate. More...
 
virtual void Qrack::QUnit::ZMask (bitCapInt mask)
 Masked Z gate. More...
 
virtual void Qrack::QUnit::PhaseParity (real1 radians, bitCapInt mask)
 
virtual void Qrack::QUnit::Phase (complex topLeft, complex bottomRight, bitLenInt qubitIndex)
 Apply a single bit transformation that only effects phase. More...
 
virtual void Qrack::QUnit::Invert (complex topRight, complex bottomLeft, bitLenInt qubitIndex)
 Apply a single bit transformation that reverses bit probability and might effect phase. More...
 
virtual void Qrack::QUnit::MCPhase (const bitLenInt *controls, bitLenInt controlLen, complex topLeft, complex bottomRight, bitLenInt target)
 Apply a single bit transformation that only effects phase, with arbitrary control bits. More...
 
virtual void Qrack::QUnit::MCInvert (const bitLenInt *controls, bitLenInt controlLen, complex topRight, complex bottomLeft, bitLenInt target)
 Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary control bits. More...
 
virtual void Qrack::QUnit::MACPhase (const bitLenInt *controls, bitLenInt controlLen, complex topLeft, complex bottomRight, bitLenInt target)
 Apply a single bit transformation that only effects phase, with arbitrary (anti-)control bits. More...
 
virtual void Qrack::QUnit::MACInvert (const bitLenInt *controls, bitLenInt controlLen, complex topRight, complex bottomLeft, bitLenInt target)
 Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary (anti-)control bits. More...
 
virtual void Qrack::QUnit::Mtrx (const complex *mtrx, bitLenInt qubit)
 Apply an arbitrary single bit unitary transformation. More...
 
virtual void Qrack::QUnit::MCMtrx (const bitLenInt *controls, bitLenInt controlLen, const complex *mtrx, bitLenInt target)
 Apply an arbitrary single bit unitary transformation, with arbitrary control bits. More...
 
virtual void Qrack::QUnit::MACMtrx (const bitLenInt *controls, bitLenInt controlLen, const complex *mtrx, bitLenInt target)
 Apply an arbitrary single bit unitary transformation, with arbitrary (anti-)control bits. More...
 
virtual void Qrack::QUnit::UniformlyControlledSingleBit (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubitIndex, const complex *mtrxs, const bitCapInt *mtrxSkipPowers, bitLenInt mtrxSkipLen, bitCapInt mtrxSkipValueMask)
 
virtual void Qrack::QUnit::CUniformParityRZ (const bitLenInt *controls, bitLenInt controlLen, bitCapInt mask, real1_f angle)
 If the controls are set and the target qubit set parity is odd, this applies a phase factor of \(e^{i angle}\). More...
 
virtual void Qrack::QUnit::CSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply a swap with arbitrary control bits. More...
 
virtual void Qrack::QUnit::AntiCSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply a swap with arbitrary (anti) control bits. More...
 
virtual void Qrack::QUnit::CSqrtSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply a square root of swap with arbitrary control bits. More...
 
virtual void Qrack::QUnit::AntiCSqrtSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply a square root of swap with arbitrary (anti) control bits. More...
 
virtual void Qrack::QUnit::CISqrtSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply an inverse square root of swap with arbitrary control bits. More...
 
virtual void Qrack::QUnit::AntiCISqrtSwap (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubit1, bitLenInt qubit2)
 Apply an inverse square root of swap with arbitrary (anti) control bits. More...
 
virtual bool Qrack::QUnit::ForceM (bitLenInt qubitIndex, bool result, bool doForce=true, bool doApply=true)
 Act as if is a measurement was applied, except force the (usually random) result. More...
 
virtual bitCapInt Qrack::QUnit::ForceMReg (bitLenInt start, bitLenInt length, bitCapInt result, bool doForce=true, bool doApply=true)
 Act as if is a measurement was applied, except force the (usually random) result. More...
 
virtual bitCapInt Qrack::QUnit::MAll ()
 Measure permutation state of all coherent bits. More...
 
virtual std::map< bitCapInt, int > Qrack::QUnit::MultiShotMeasureMask (const bitCapInt *qPowers, bitLenInt qPowerCount, unsigned shots)
 Statistical measure of masked permutation probability. More...
 
virtual void Qrack::QUnit::MultiShotMeasureMask (const bitCapInt *qPowers, bitLenInt qPowerCount, unsigned shots, unsigned *shotsArray)
 Statistical measure of masked permutation probability (returned as array) More...
 

Detailed Description

Function Documentation

◆ AI()

void Qrack::QInterface::AI ( bitLenInt  target,
real1_f  azimuth,
real1_f  inclination 
)
virtual

"Azimuth, Inclination" (RY-RZ)

"Azimuth, Inclination"

Sets the azimuth and inclination from Z-X-Y basis probability measurements.

◆ AntiCCNOT()

void Qrack::QInterface::AntiCCNOT ( bitLenInt  control1,
bitLenInt  control2,
bitLenInt  target 
)
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.

◆ AntiCCY()

void Qrack::QInterface::AntiCCY ( bitLenInt  control1,
bitLenInt  control2,
bitLenInt  target 
)
virtual

Anti doubly-controlled Y gate.

"Anti-doubly-controlled Y" - Apply Pauli Y if control bits are both zero, do not apply if either control bit is one.

If both controls are set to 0, apply Pauli Y operation to target bit.

◆ AntiCCZ()

void Qrack::QInterface::AntiCCZ ( bitLenInt  control1,
bitLenInt  control2,
bitLenInt  target 
)
virtual

Anti doubly-controlled Z gate.

"Anti-doubly-controlled Z" - Apply Pauli Z if control bits are both zero, do not apply if either control bit is one.

If both controls are set to 0, apply Pauli Z operation to target bit.

◆ AntiCH()

void Qrack::QInterface::AntiCH ( bitLenInt  control,
bitLenInt  target 
)
virtual

(Anti-)controlled H gate

Apply (anti-)controlled Hadamard matrix to bit.

If the "control" bit is set to 1, then the "H" Walsh-Hadamard transform operator is applied to "target."

◆ AntiCIPhaseRootN()

void Qrack::QInterface::AntiCIPhaseRootN ( bitLenInt  n,
bitLenInt  control,
bitLenInt  target 
)
virtual

(Anti-)controlled inverse "PhaseRootN" gate

Apply (anti-)controlled "IPhaseRootN" gate to bit.

If the "control" bit is set to 0, then the inverse "PhaseRootN" gate is applied to "target."

◆ AntiCIS()

void Qrack::QInterface::AntiCIS ( bitLenInt  control,
bitLenInt  target 
)
virtual

(Anti-)controlled inverse S gate

Apply (anti-)controlled IS gate to bit.

If the "control" bit is set to 1, then the inverse S gate is applied to "target."

◆ AntiCISqrtSwap() [1/2]

void Qrack::QUnit::AntiCISqrtSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply an inverse square root of swap with arbitrary (anti) control bits.

Reimplemented from Qrack::QInterface.

◆ AntiCISqrtSwap() [2/2]

void Qrack::QInterface::AntiCISqrtSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply an inverse square root of swap with arbitrary (anti) control bits.

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QHybrid, Qrack::QUnit, and Qrack::QEngine.

◆ AntiCNOT()

void Qrack::QInterface::AntiCNOT ( bitLenInt  control,
bitLenInt  target 
)
virtual

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.

◆ AntiCPhaseRootN()

void Qrack::QInterface::AntiCPhaseRootN ( bitLenInt  n,
bitLenInt  control,
bitLenInt  target 
)
virtual

(Anti-)controlled "PhaseRootN" gate

Apply (anti-)controlled "PhaseRootN" gate to bit.

If the "control" bit is set to 0, then the "PhaseRootN" gate is applied to "target."

◆ AntiCS()

void Qrack::QInterface::AntiCS ( bitLenInt  control,
bitLenInt  target 
)
virtual

(Anti-)controlled S gate

Apply (anti-)controlled S gate to bit.

If the "control" bit is set to 1, then the S gate is applied to "target."

◆ AntiCSqrtSwap() [1/2]

void Qrack::QUnit::AntiCSqrtSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply a square root of swap with arbitrary (anti) control bits.

Reimplemented from Qrack::QInterface.

◆ AntiCSqrtSwap() [2/2]

void Qrack::QInterface::AntiCSqrtSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply a square root of swap with arbitrary (anti) control bits.

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QHybrid, Qrack::QUnit, and Qrack::QEngine.

◆ AntiCSwap() [1/2]

void Qrack::QUnit::AntiCSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply a swap with arbitrary (anti) control bits.

Reimplemented from Qrack::QInterface.

◆ AntiCSwap() [2/2]

void Qrack::QInterface::AntiCSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply a swap with arbitrary (anti) control bits.

Reimplemented in Qrack::QMaskFusion, Qrack::QHybrid, Qrack::QUnit, and Qrack::QEngine.

◆ AntiCU()

void Qrack::QInterface::AntiCU ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  target,
real1_f  theta,
real1_f  phi,
real1_f  lambda 
)
virtual

(Anti-)Controlled general unitary gate

Applies an (anti-)controlled gate guaranteed to be unitary, from three angles, as commonly defined, spanning all possible single bit unitary gates, (up to a global phase factor which has no effect on Hermitian operator expectation values).

◆ AntiCY()

void Qrack::QInterface::AntiCY ( bitLenInt  control,
bitLenInt  target 
)
virtual

Anti controlled Y 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, then the Pauli "Y" operator is applied to the target.

◆ AntiCZ()

void Qrack::QInterface::AntiCZ ( bitLenInt  control,
bitLenInt  target 
)
virtual

Anti controlled Z gate.

"Anti-controlled Z" - Apply Pauli Z if control bit is zero, do not apply if control bit is one.

If the control is set to 0, then the Pauli "Z" operator is applied to the target.

◆ CCNOT()

void Qrack::QInterface::CCNOT ( bitLenInt  control1,
bitLenInt  control2,
bitLenInt  target 
)
virtual

Doubly-controlled NOT gate.

Doubly-controlled not.

If both controls are set to 1, the target bit is NOT-ed or X-ed.

◆ CCY()

void Qrack::QInterface::CCY ( bitLenInt  control1,
bitLenInt  control2,
bitLenInt  target 
)
virtual

Doubly-Controlled Y gate.

Apply doubly-controlled Pauli Z matrix to bit.

If both "control" bits are set to 1, then the Pauli "Y" operator is applied to "target."

◆ CCZ()

void Qrack::QInterface::CCZ ( bitLenInt  control1,
bitLenInt  control2,
bitLenInt  target 
)
virtual

Doubly-Controlled Z gate.

Apply doubly-controlled Pauli Z matrix to bit.

If both "control" bits are set to 1, then the Pauli "Z" operator is applied to "target."

◆ CH()

void Qrack::QInterface::CH ( bitLenInt  control,
bitLenInt  target 
)
virtual

Controlled H gate.

Apply controlled Hadamard matrix to bit.

If the "control" bit is set to 1, then the "H" Walsh-Hadamard transform operator is applied to "target."

◆ CIPhaseRootN()

void Qrack::QInterface::CIPhaseRootN ( bitLenInt  n,
bitLenInt  control,
bitLenInt  target 
)
virtual

Controlled inverse "PhaseRootN" gate.

Apply controlled "IPhaseRootN" gate to bit.

If the "control" bit is set to 1, then the inverse "PhaseRootN" gate is applied to "target."

◆ CIS()

void Qrack::QInterface::CIS ( bitLenInt  control,
bitLenInt  target 
)
virtual

Controlled inverse S gate.

Apply controlled IS gate to bit.

If the "control" bit is set to 1, then the inverse S gate is applied to "target."

◆ CISqrtSwap() [1/2]

void Qrack::QUnit::CISqrtSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply an inverse square root of swap with arbitrary control bits.

Reimplemented from Qrack::QInterface.

◆ CISqrtSwap() [2/2]

void Qrack::QInterface::CISqrtSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply an inverse square root of swap with arbitrary control bits.

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QHybrid, Qrack::QUnit, and Qrack::QEngine.

◆ CIT()

void Qrack::QInterface::CIT ( bitLenInt  control,
bitLenInt  target 
)
virtual

Controlled inverse T gate.

Apply controlled IT gate to bit.

If the "control" bit is set to 1, then the inverse T gate is applied to "target."

◆ CNOT()

void Qrack::QInterface::CNOT ( bitLenInt  control,
bitLenInt  target 
)
virtual

Controlled NOT gate.

Controlled not.

If the control is set to 1, the target bit is NOT-ed or X-ed.

Reimplemented in Qrack::QStabilizer.

◆ CPhaseRootN()

void Qrack::QInterface::CPhaseRootN ( bitLenInt  n,
bitLenInt  control,
bitLenInt  target 
)
virtual

Controlled "PhaseRootN" gate.

Apply controlled "PhaseRootN" gate to bit.

If the "control" bit is set to 1, then the "PhaseRootN" gate is applied to "target."

◆ CS()

void Qrack::QInterface::CS ( bitLenInt  control,
bitLenInt  target 
)
virtual

Controlled S gate.

Apply controlled S gate to bit.

If the "control" bit is set to 1, then the S gate is applied to "target."

◆ CSqrtSwap() [1/2]

void Qrack::QUnit::CSqrtSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply a square root of swap with arbitrary control bits.

Reimplemented from Qrack::QInterface.

◆ CSqrtSwap() [2/2]

void Qrack::QInterface::CSqrtSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply a square root of swap with arbitrary control bits.

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QHybrid, Qrack::QUnit, and Qrack::QEngine.

◆ CSwap() [1/2]

void Qrack::QUnit::CSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply a swap with arbitrary control bits.

Reimplemented from Qrack::QInterface.

◆ CSwap() [2/2]

void Qrack::QInterface::CSwap ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Apply a swap with arbitrary control bits.

Reimplemented in Qrack::QMaskFusion, Qrack::QHybrid, Qrack::QUnit, and Qrack::QEngine.

◆ CT()

void Qrack::QInterface::CT ( bitLenInt  control,
bitLenInt  target 
)
virtual

Controlled T gate.

Apply controlled T gate to bit.

If the "control" bit is set to 1, then the T gate is applied to "target."

◆ CU()

void Qrack::QInterface::CU ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  target,
real1_f  theta,
real1_f  phi,
real1_f  lambda 
)
virtual

Controlled general unitary gate.

Applies a controlled gate guaranteed to be unitary, from three angles, as commonly defined, spanning all possible single bit unitary gates, (up to a global phase factor which has no effect on Hermitian operator expectation values).

◆ CUniformParityRZ()

void Qrack::QUnit::CUniformParityRZ ( const bitLenInt controls,
bitLenInt  controlLen,
bitCapInt  mask,
real1_f  angle 
)
virtual

If the controls are set and the target qubit set parity is odd, this applies a phase factor of \(e^{i angle}\).

If the controls are set and the target qubit set parity is even, this applies the conjugate, \(e^{-i angle}\). Otherwise, do nothing if any control is not set.

Implements Qrack::QParity.

◆ CY()

void Qrack::QInterface::CY ( bitLenInt  control,
bitLenInt  target 
)
virtual

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::QStabilizer.

◆ CZ()

void Qrack::QInterface::CZ ( bitLenInt  control,
bitLenInt  target 
)
virtual

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::QStabilizer.

◆ ForceM() [1/2]

bool Qrack::QUnit::ForceM ( bitLenInt  qubit,
bool  result,
bool  doForce = true,
bool  doApply = true 
)
virtual

Act as if is a measurement was applied, except force the (usually random) result.

Warning
PSEUDO-QUANTUM

Implements Qrack::QInterface.

◆ ForceM() [2/2]

virtual bool Qrack::QInterface::ForceM ( bitLenInt  qubit,
bool  result,
bool  doForce = true,
bool  doApply = true 
)
pure virtual

Act as if is a measurement was applied, except force the (usually random) result.

Warning
PSEUDO-QUANTUM

Implemented in Qrack::QMaskFusion, Qrack::QStabilizerHybrid, Qrack::QStabilizer, Qrack::QHybrid, Qrack::QBdt, Qrack::QPager, Qrack::QUnit, and Qrack::QEngine.

◆ ForceMReg()

bitCapInt Qrack::QUnit::ForceMReg ( bitLenInt  start,
bitLenInt  length,
bitCapInt  result,
bool  doForce = true,
bool  doApply = true 
)
virtual

Act as if is a measurement was applied, except force the (usually random) result.

Bit-wise apply measurement gate to a register.

Warning
PSEUDO-QUANTUM

Reimplemented from Qrack::QInterface.

◆ H() [1/2]

void Qrack::QUnit::H ( bitLenInt  qubitIndex)
virtual

Hadamard gate.

Applies a Hadamard gate on qubit at "qubitIndex."

Reimplemented from Qrack::QInterface.

◆ H() [2/2]

virtual void Qrack::QInterface::H ( bitLenInt  qubitIndex)
virtual

Hadamard gate.

Applies a Hadamard gate on qubit at "qubitIndex."

Reimplemented in Qrack::QStabilizer, and Qrack::QUnit.

◆ HIS()

virtual void Qrack::QInterface::HIS ( bitLenInt  qubitIndex)
virtual

Y-basis (inverse) transformation gate.

Converts from Pauli Y basis to Z, (via IS then H gates).

◆ IAI()

void Qrack::QInterface::IAI ( bitLenInt  target,
real1_f  azimuth,
real1_f  inclination 
)
virtual

Invert "Azimuth, Inclination" (RY-RZ)

Inverse "Azimuth, Inclination".

(Inverse of) sets the azimuth and inclination from Z-X-Y basis probability measurements.

◆ Invert() [1/2]

void Qrack::QUnit::Invert ( complex  topRight,
complex  bottomLeft,
bitLenInt  qubitIndex 
)
virtual

Apply a single bit transformation that reverses bit probability and might effect phase.

Reimplemented from Qrack::QInterface.

◆ Invert() [2/2]

void Qrack::QInterface::Invert ( const complex  topRight,
const complex  bottomLeft,
bitLenInt  qubitIndex 
)
virtual

Apply a single bit transformation that reverses bit probability and might effect phase.

Reimplemented in Qrack::QMaskFusion, Qrack::QStabilizer, Qrack::QEngineOCL, Qrack::QHybrid, Qrack::QPager, and Qrack::QUnit.

◆ IPhaseRootN()

void Qrack::QInterface::IPhaseRootN ( bitLenInt  n,
bitLenInt  qubitIndex 
)
virtual

Inverse "PhaseRootN" gate.

Apply inverse 1/(2^N) phase rotation.

Applies an inverse 1/(2^N) phase rotation to the qubit at "qubitIndex."

◆ IS() [1/2]

void Qrack::QUnit::IS ( bitLenInt  qubitIndex)
virtual

Inverse S gate.

Apply inverse 1/4 phase rotation.

Applies an inverse 1/4 phase rotation to the qubit at "qubitIndex."

Reimplemented from Qrack::QInterface.

◆ IS() [2/2]

void Qrack::QInterface::IS ( bitLenInt  qubitIndex)
virtual

Inverse S gate.

Apply inverse 1/4 phase rotation.

Applies an inverse 1/4 phase rotation to the qubit at "qubitIndex."

Reimplemented in Qrack::QStabilizer, and Qrack::QUnit.

◆ ISqrtX()

virtual void Qrack::QInterface::ISqrtX ( bitLenInt  qubitIndex)
virtual

Inverse square root of X gate.

Applies the (by convention) inverse square root of the Pauli "X" operator to the qubit at "qubitIndex." The Pauli "X" operator is equivalent to a logical "NOT."

◆ ISqrtXConjT()

virtual void Qrack::QInterface::ISqrtXConjT ( bitLenInt  qubitIndex)
virtual

Inverse phased square root of X gate.

Applies IT.ISqrtX.T to the qubit at "qubitIndex."

◆ ISqrtY()

virtual void Qrack::QInterface::ISqrtY ( bitLenInt  qubitIndex)
virtual

Square root of Y gate.

Applies the (by convention) inverse square root of the Pauli "Y" operator to the qubit at "qubitIndex." The Pauli "Y" operator is similar to a logical "NOT" with permutation phase effects.

◆ IT()

void Qrack::QInterface::IT ( bitLenInt  qubitIndex)
virtual

Inverse T gate.

Apply inverse 1/8 phase rotation.

Applies an inverse 1/8 phase rotation to the qubit at "qubitIndex."

◆ IU2()

virtual void Qrack::QInterface::IU2 ( bitLenInt  target,
real1_f  phi,
real1_f  lambda 
)
inlinevirtual

Inverse 2-parameter unitary gate.

Applies the inverse of U2

◆ M()

virtual bool Qrack::QInterface::M ( bitLenInt  qubitIndex)
inlinevirtual

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::QStabilizerHybrid, Qrack::QBdt, Qrack::QPager, Qrack::QUnit, and Qrack::QEngine.

◆ MACInvert() [1/2]

void Qrack::QUnit::MACInvert ( const bitLenInt controls,
bitLenInt  controlLen,
complex  topRight,
complex  bottomLeft,
bitLenInt  target 
)
virtual

Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary (anti-)control bits.

Reimplemented from Qrack::QInterface.

◆ MACInvert() [2/2]

void Qrack::QInterface::MACInvert ( const bitLenInt controls,
bitLenInt  controlLen,
complex  topRight,
complex  bottomLeft,
bitLenInt  target 
)
virtual

Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary (anti-)control bits.

Reimplemented in Qrack::QStabilizerHybrid, and Qrack::QUnit.

◆ MACMtrx() [1/2]

void Qrack::QUnit::MACMtrx ( const bitLenInt controls,
bitLenInt  controlLen,
const complex mtrx,
bitLenInt  target 
)
virtual

Apply an arbitrary single bit unitary transformation, with arbitrary (anti-)control bits.

Reimplemented from Qrack::QInterface.

◆ MACMtrx() [2/2]

void Qrack::QInterface::MACMtrx ( const bitLenInt controls,
bitLenInt  controlLen,
const complex mtrx,
bitLenInt  target 
)
virtual

Apply an arbitrary single bit unitary transformation, with arbitrary (anti-)control bits.

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QBdt, Qrack::QHybrid, Qrack::QPager, Qrack::QUnit, and Qrack::QEngine.

◆ MACPhase() [1/2]

void Qrack::QUnit::MACPhase ( const bitLenInt controls,
bitLenInt  controlLen,
complex  topLeft,
complex  bottomRight,
bitLenInt  target 
)
virtual

Apply a single bit transformation that only effects phase, with arbitrary (anti-)control bits.

Reimplemented from Qrack::QInterface.

◆ MACPhase() [2/2]

void Qrack::QInterface::MACPhase ( const bitLenInt controls,
bitLenInt  controlLen,
complex  topLeft,
complex  bottomRight,
bitLenInt  target 
)
virtual

Apply a single bit transformation that only effects phase, with arbitrary (anti-)control bits.

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, and Qrack::QUnit.

◆ MAll()

bitCapInt Qrack::QUnit::MAll ( )
virtual

Measure permutation state of all coherent bits.

Reimplemented from Qrack::QInterface.

◆ MCInvert() [1/2]

void Qrack::QUnit::MCInvert ( const bitLenInt controls,
bitLenInt  controlLen,
complex  topRight,
complex  bottomLeft,
bitLenInt  target 
)
virtual

Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary control bits.

Reimplemented from Qrack::QInterface.

◆ MCInvert() [2/2]

void Qrack::QInterface::MCInvert ( const bitLenInt controls,
bitLenInt  controlLen,
complex  topRight,
complex  bottomLeft,
bitLenInt  target 
)
virtual

Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary control bits.

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QStabilizer, Qrack::QBdt, and Qrack::QUnit.

◆ MCMtrx() [1/2]

void Qrack::QUnit::MCMtrx ( const bitLenInt controls,
bitLenInt  controlLen,
const complex mtrx,
bitLenInt  target 
)
virtual

Apply an arbitrary single bit unitary transformation, with arbitrary control bits.

Implements Qrack::QInterface.

◆ MCMtrx() [2/2]

virtual void Qrack::QInterface::MCMtrx ( const bitLenInt controls,
bitLenInt  controlLen,
const complex mtrx,
bitLenInt  target 
)
pure virtual

Apply an arbitrary single bit unitary transformation, with arbitrary control bits.

Implemented in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QStabilizer, Qrack::QBdt, Qrack::QHybrid, Qrack::QPager, Qrack::QUnit, and Qrack::QEngine.

◆ MCPhase() [1/2]

void Qrack::QUnit::MCPhase ( const bitLenInt controls,
bitLenInt  controlLen,
complex  topLeft,
complex  bottomRight,
bitLenInt  target 
)
virtual

Apply a single bit transformation that only effects phase, with arbitrary control bits.

Reimplemented from Qrack::QInterface.

◆ MCPhase() [2/2]

void Qrack::QInterface::MCPhase ( const bitLenInt controls,
bitLenInt  controlLen,
complex  topLeft,
complex  bottomRight,
bitLenInt  target 
)
virtual

Apply a single bit transformation that only effects phase, with arbitrary control bits.

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QStabilizer, Qrack::QBdt, and Qrack::QUnit.

◆ Mtrx() [1/2]

void Qrack::QUnit::Mtrx ( const complex mtrx,
bitLenInt  qubitIndex 
)
virtual

Apply an arbitrary single bit unitary transformation.

Implements Qrack::QInterface.

◆ Mtrx() [2/2]

virtual void Qrack::QInterface::Mtrx ( const complex mtrx,
bitLenInt  qubitIndex 
)
pure virtual

Apply an arbitrary single bit unitary transformation.

Implemented in Qrack::QStabilizerHybrid, Qrack::QStabilizer, Qrack::QMaskFusion, Qrack::QBdt, Qrack::QHybrid, Qrack::QPager, Qrack::QUnit, and Qrack::QEngine.

◆ MultiShotMeasureMask() [1/2]

std::map< bitCapInt, int > Qrack::QUnit::MultiShotMeasureMask ( const bitCapInt qPowers,
bitLenInt  qPowerCount,
unsigned  shots 
)
virtual

Statistical measure of masked permutation probability.

"qPowers" contains powers of 2^n, each representing QInterface bit "n." The order of these values defines a mask for the result bitCapInt, of 2^0 ~ qPowers[0] to 2^(qPowerCount - 1) ~ qPowers[qPowerCount - 1], in contiguous ascending order. "shots" specifies the number of samples to take as if totally re-preparing the pre-measurement state. This method returns a dictionary with keys, which are the (masked-order) measurement results, and values, which are the number of "shots" that produced that particular measurement result. This method does not "collapse" the state of this QInterface. (The idea is to efficiently simulate a potentially statistically random sample of multiple re-preparations of the state right before measurement, and to collect random measurement resutls, without forcing the user to re-prepare or "clone" the state.)

Warning
PSEUDO-QUANTUM

Reimplemented from Qrack::QInterface.

◆ MultiShotMeasureMask() [2/2]

void Qrack::QUnit::MultiShotMeasureMask ( const bitCapInt qPowers,
bitLenInt  qPowerCount,
unsigned  shots,
unsigned *  shotsArray 
)
virtual

Statistical measure of masked permutation probability (returned as array)

Same Qrack::MultiShotMeasureMask(), except the shots are returned as an array.

Warning
PSEUDO-QUANTUM

Reimplemented from Qrack::QInterface.

◆ Phase() [1/2]

void Qrack::QUnit::Phase ( complex  topLeft,
complex  bottomRight,
bitLenInt  qubitIndex 
)
virtual

Apply a single bit transformation that only effects phase.

Reimplemented from Qrack::QInterface.

◆ Phase() [2/2]

void Qrack::QInterface::Phase ( const complex  topLeft,
const complex  bottomRight,
bitLenInt  qubitIndex 
)
virtual

Apply a single bit transformation that only effects phase.

Reimplemented in Qrack::QStabilizer, Qrack::QMaskFusion, Qrack::QEngineOCL, Qrack::QHybrid, Qrack::QPager, and Qrack::QUnit.

◆ PhaseParity() [1/2]

void Qrack::QUnit::PhaseParity ( real1  radians,
bitCapInt  mask 
)
virtual

◆ PhaseParity() [2/2]

void Qrack::QInterface::PhaseParity ( real1_f  radians,
bitCapInt  mask 
)
virtual

Parity phase gate.

Applies e^(i*angle) phase factor to all combinations of bits with odd parity, based upon permutations of qubits.

Reimplemented in Qrack::QEngineOCL, Qrack::QEngineCPU, Qrack::QHybrid, and Qrack::QPager.

◆ PhaseRootN()

void Qrack::QInterface::PhaseRootN ( bitLenInt  n,
bitLenInt  qubitIndex 
)
virtual

"PhaseRootN" gate

Apply 1/(2^N) phase rotation.

Applies a 1/(2^N) phase rotation to the qubit at "qubitIndex."

◆ S() [1/2]

void Qrack::QUnit::S ( bitLenInt  qubitIndex)
virtual

S gate.

Apply 1/4 phase rotation.

Applies a 1/4 phase rotation to the qubit at "qubitIndex."

Reimplemented from Qrack::QInterface.

◆ S() [2/2]

void Qrack::QInterface::S ( bitLenInt  qubitIndex)
virtual

S gate.

Apply 1/4 phase rotation.

Applies a 1/4 phase rotation to the qubit at "qubitIndex."

Reimplemented in Qrack::QStabilizer, and Qrack::QUnit.

◆ SH()

virtual void Qrack::QInterface::SH ( bitLenInt  qubitIndex)
virtual

Y-basis transformation gate.

Converts from Pauli Z basis to Y, (via H then S gates).

◆ SqrtH()

virtual void Qrack::QInterface::SqrtH ( bitLenInt  qubitIndex)
virtual

Square root of Hadamard gate.

Applies the square root of the Hadamard gate on qubit at "qubitIndex."

◆ SqrtX()

virtual void Qrack::QInterface::SqrtX ( bitLenInt  qubitIndex)
virtual

Square root of X gate.

Applies the square root of the Pauli "X" operator to the qubit at "qubitIndex." The Pauli "X" operator is equivalent to a logical "NOT."

◆ SqrtXConjT()

virtual void Qrack::QInterface::SqrtXConjT ( bitLenInt  qubitIndex)
virtual

Phased square root of X gate.

Applies T.SqrtX.IT to the qubit at "qubitIndex."

◆ SqrtY()

virtual void Qrack::QInterface::SqrtY ( bitLenInt  qubitIndex)
virtual

Square root of Y gate.

Applies the square root of the Pauli "Y" operator to the qubit at "qubitIndex." The Pauli "Y" operator is similar to a logical "NOT" with permutation phase effects.

◆ T()

void Qrack::QInterface::T ( bitLenInt  qubitIndex)
virtual

T gate.

Apply 1/8 phase rotation.

Applies a 1/8 phase rotation to the qubit at "qubitIndex."

◆ TimeEvolve()

void Qrack::QInterface::TimeEvolve ( Hamiltonian  h,
real1_f  timeDiff 
)
virtual

To define a Hamiltonian, give a vector of controlled single bit gates ("HamiltonianOp" instances) that are applied by left-multiplication in low-to-high vector index order on the state vector.

Warning
Hamiltonian components might not commute.

As a general point of linear algebra, where A and B are linear operators,

\begin{equation}e^{i (A + B) t} = e^{i A t} e^{i B t} \end{equation}

might NOT hold, if the operators A and B do not commute. As a rule of thumb, A will commute with B at least in the case that A and B act on entirely different sets of qubits. However, for defining the intended Hamiltonian, the programmer can be guaranteed that the exponential factors will be applied right-to-left, by left multiplication, in the order

\begin{equation} e^{-i H_{N - 1} t} e^{-i H_{N - 2} t} \ldots e^{-i H_0 t} \left|\psi \rangle\right. .\end{equation}

(For example, if A and B are single bit gates acting on the same bit, form their composition into one gate by the intended right-to-left fusion and apply them as a single HamiltonianOp.)

◆ U()

void Qrack::QInterface::U ( bitLenInt  target,
real1_f  theta,
real1_f  phi,
real1_f  lambda 
)
virtual

General unitary gate.

Applies a gate guaranteed to be unitary, from three angles, as commonly defined, spanning all possible single bit unitary gates, (up to a global phase factor which has no effect on Hermitian operator expectation values).

◆ U2()

virtual void Qrack::QInterface::U2 ( bitLenInt  target,
real1_f  phi,
real1_f  lambda 
)
inlinevirtual

2-parameter unitary gate

Applies a gate guaranteed to be unitary, from two angles, as commonly defined.

◆ UniformlyControlledSingleBit() [1/3]

void Qrack::QUnit::UniformlyControlledSingleBit ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubitIndex,
const complex mtrxs,
const bitCapInt mtrxSkipPowers,
bitLenInt  mtrxSkipLen,
bitCapInt  mtrxSkipValueMask 
)
virtual

Reimplemented from Qrack::QInterface.

◆ UniformlyControlledSingleBit() [2/3]

virtual void Qrack::QInterface::UniformlyControlledSingleBit ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubitIndex,
const complex mtrxs 
)
inlinevirtual

Apply a "uniformly controlled" arbitrary single bit unitary transformation.

(See https://arxiv.org/abs/quant-ph/0312218)

A different unitary 2x2 complex matrix is associated with each permutation of the control bits. The first control bit index in the "controls" array is the least significant bit of the permutation, proceeding to the most significant bit. "mtrxs" is a flat (1-dimensional) array where each subsequent set of 4 components is an arbitrary 2x2 single bit gate associated with the next permutation of the control bits, starting from 0. All combinations of control bits apply one of the 4 component (flat 2x2) matrices. For k control bits, there are therefore 4 * 2^k complex components in "mtrxs," representing 2^k complex matrices of 2x2 components. (The component ordering in each matrix is the same as all other gates with an arbitrary 2x2 applied to a single bit, such as Qrack::ApplySingleBit.)

Reimplemented in Qrack::QStabilizerHybrid.

◆ UniformlyControlledSingleBit() [3/3]

void Qrack::QInterface::UniformlyControlledSingleBit ( const bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubitIndex,
const complex mtrxs,
const bitCapInt mtrxSkipPowers,
bitLenInt  mtrxSkipLen,
bitCapInt  mtrxSkipValueMask 
)
virtual

◆ X()

virtual void Qrack::QInterface::X ( bitLenInt  qubitIndex)
virtual

X gate.

Applies the Pauli "X" operator to the qubit at "qubitIndex." The Pauli "X" operator is equivalent to a logical "NOT."

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QEngineOCL, Qrack::QBdt, Qrack::QStabilizer, Qrack::QPager, Qrack::QUnit, and Qrack::QEngine.

◆ XMask()

void Qrack::QInterface::XMask ( bitCapInt  mask)
virtual

Masked X gate.

Applies the Pauli "X" operator to all qubits in the mask. A qubit index "n" is in the mask if (((1 << n) & mask)

0). The Pauli "X" operator is equivalent to a logical "NOT."

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QEngineOCL, Qrack::QEngineCPU, Qrack::QHybrid, and Qrack::QPager.

◆ Y()

virtual void Qrack::QInterface::Y ( bitLenInt  qubitIndex)
virtual

Y gate.

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::QMaskFusion, and Qrack::QStabilizer.

◆ YMask()

void Qrack::QInterface::YMask ( bitCapInt  mask)
virtual

Masked Y gate.

Applies the Pauli "Y" operator to all qubits in the mask. A qubit index "n" is in the mask if (((1 << n) & mask)

0). The Pauli "Y" operator is similar to a logical "NOT" with permutation phase.

Reimplemented in Qrack::QStabilizerHybrid.

◆ Z()

virtual void Qrack::QInterface::Z ( bitLenInt  qubitIndex)
virtual

Z gate.

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::QMaskFusion, Qrack::QEngineOCL, and Qrack::QStabilizer.

◆ ZMask() [1/2]

virtual void Qrack::QUnit::ZMask ( bitCapInt  mask)
inlinevirtual

Masked Z gate.

Applies the Pauli "Z" operator to all qubits in the mask. A qubit index "n" is in the mask if (((1 << n) & mask)

0). The Pauli "Z" operator reverses the phase of |1> and leaves |0> unchanged.

Reimplemented from Qrack::QInterface.

◆ ZMask() [2/2]

void Qrack::QInterface::ZMask ( bitCapInt  mask)
virtual

Masked Z gate.

Applies the Pauli "Z" operator to all qubits in the mask. A qubit index "n" is in the mask if (((1 << n) & mask)

0). The Pauli "Z" operator reverses the phase of |1> and leaves |0> unchanged.

Reimplemented in Qrack::QStabilizerHybrid, Qrack::QPager, Qrack::QUnit, and Qrack::QEngine.