Qrack  9.0
General classical-emulating-quantum development framework
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
Qrack::QUnitClifford Class Reference

#include <qunitclifford.hpp>

Inheritance diagram for Qrack::QUnitClifford:
Inheritance graph
[legend]
Collaboration diagram for Qrack::QUnitClifford:
Collaboration graph
[legend]

Classes

struct  QSortEntry
 

Public Member Functions

 QUnitClifford (bitLenInt n, bitCapInt perm=0U, qrack_rand_gen_ptr rgp=nullptr, complex phasFac=CMPLX_DEFAULT_ARG, bool doNorm=false, bool randomGlobalPhase=true, bool ignored2=false, int64_t ignored3=-1, bool useHardwareRNG=true, bool ignored4=false, real1_f ignored5=REAL1_EPSILON, std::vector< int64_t > ignored6={}, bitLenInt ignored7=0U, real1_f ignored8=FP_NORM_EPSILON_F)
 
 ~QUnitClifford ()
 
QInterfacePtr Clone ()
 Clone this QInterface. More...
 
QUnitCliffordPtr CloneEmpty ()
 
bool isClifford ()
 Returns "true" if current state is identifiably within the Clifford set, or "false" if it is not or cannot be determined. More...
 
bool isClifford (bitLenInt qubit)
 Returns "true" if current qubit state is identifiably within the Clifford set, or "false" if it is not or cannot be determined. More...
 
bitLenInt GetQubitCount ()
 Get the count of bits in this register. More...
 
bitCapInt GetMaxQPower ()
 Get the maximum number of basis states, namely \( 2^n \) for \( n \) qubits. More...
 
void SetDevice (int64_t dID)
 Set the device index, if more than one device is available. More...
 
void SetRandGlobalPhase (bool isRand)
 
void ResetPhaseOffset ()
 
complex GetPhaseOffset ()
 
bitCapInt PermCount ()
 
void Clear ()
 
real1_f ExpectationBitsFactorized (const std::vector< bitLenInt > &bits, const std::vector< bitCapInt > &perms, bitCapInt offset=0U)
 Get expectation value of bits, given an array of qubit weights. More...
 
real1_f ExpectationFloatsFactorized (const std::vector< bitLenInt > &bits, const std::vector< real1_f > &weights)
 Get expectation value of bits, given a (floating-point) array of qubit weights. More...
 
real1_f ProbPermRdm (bitCapInt perm, bitLenInt ancillaeStart)
 
real1_f ProbMask (bitCapInt mask, bitCapInt permutation)
 Direct measure of masked permutation probability. More...
 
void SetPermutation (bitCapInt perm, complex phaseFac=CMPLX_DEFAULT_ARG)
 Set to a specific permutation of all qubits. More...
 
QStabilizerPtr MakeStabilizer (bitLenInt length=1U, bitCapInt perm=0U, complex phaseFac=CMPLX_DEFAULT_ARG)
 
void SetQuantumState (const complex *inputState)
 Set an arbitrary pure quantum state representation. More...
 
void SetAmplitude (bitCapInt perm, complex amp)
 Sets the representational amplitude of a full permutation. More...
 
void CNOT (bitLenInt c, bitLenInt t)
 Apply a CNOT gate with control and target. More...
 
void CY (bitLenInt c, bitLenInt t)
 Apply a CY gate with control and target. More...
 
void CZ (bitLenInt c, bitLenInt t)
 Apply a CZ gate with control and target. More...
 
void AntiCNOT (bitLenInt c, bitLenInt t)
 Apply an (anti-)CNOT gate with control and target. More...
 
void AntiCY (bitLenInt c, bitLenInt t)
 Apply an (anti-)CY gate with control and target. More...
 
void AntiCZ (bitLenInt c, bitLenInt t)
 Apply an (anti-)CZ gate with control and target. More...
 
void H (bitLenInt t)
 Hadamard gate. More...
 
void S (bitLenInt t)
 Apply a phase gate (|0>->|0>, |1>->i|1>, or "S") to qubit b. More...
 
void IS (bitLenInt t)
 Apply an inverse phase gate (|0>->|0>, |1>->-i|1>, or "S adjoint") to qubit b. More...
 
void Z (bitLenInt t)
 Apply a phase gate (|0>->|0>, |1>->-|1>, or "Z") to qubit b. More...
 
void X (bitLenInt t)
 X gate. More...
 
void Y (bitLenInt t)
 Apply a Pauli Y gate to target. More...
 
void Swap (bitLenInt qubit1, bitLenInt qubit2)
 Swap values of two bits in register. More...
 
void ISwap (bitLenInt c, bitLenInt t)
 Swap values of two bits in register, and apply phase factor of i if bits are different. More...
 
void IISwap (bitLenInt c, bitLenInt t)
 Inverse ISwap - Swap values of two bits in register, and apply phase factor of -i if bits are different. More...
 
bool ForceM (bitLenInt t, bool result, bool doForce=true, bool doApply=true)
 Measure qubit t. More...
 
bitCapInt MAll ()
 Measure all qubits. More...
 
std::map< bitCapInt, int > MultiShotMeasureMask (const std::vector< bitCapInt > &qPowers, unsigned shots)
 Statistical measure of masked permutation probability. More...
 
void MultiShotMeasureMask (const std::vector< bitCapInt > &qPowers, unsigned shots, unsigned long long *shotsArray)
 Statistical measure of masked permutation probability (returned as array) More...
 
void GetQuantumState (complex *stateVec)
 Convert the state to ket notation. More...
 
void GetQuantumState (QInterfacePtr eng)
 Convert the state to ket notation, directly into another QInterface. More...
 
std::map< bitCapInt, complexGetQuantumState ()
 Convert the state to sparse ket notation. More...
 
void GetProbs (real1 *outputProbs)
 Get all probabilities corresponding to ket notation. More...
 
complex GetAmplitude (bitCapInt perm)
 Get a single basis state amplitude. More...
 
std::vector< complexGetAmplitudes (std::vector< bitCapInt > perms)
 Get a single basis state amplitude. More...
 
bool IsSeparableZ (const bitLenInt &t)
 Returns "true" if target qubit is a Z basis eigenstate. More...
 
bool IsSeparableX (const bitLenInt &t)
 Returns "true" if target qubit is an X basis eigenstate. More...
 
bool IsSeparableY (const bitLenInt &t)
 Returns "true" if target qubit is a Y basis eigenstate. More...
 
uint8_t IsSeparable (const bitLenInt &t)
 Returns: 0 if target qubit is not separable 1 if target qubit is a Z basis eigenstate 2 if target qubit is an X basis eigenstate 3 if target qubit is a Y basis eigenstate. More...
 
bool CanDecomposeDispose (const bitLenInt start, const bitLenInt length)
 
bitLenInt Compose (QUnitCliffordPtr toCopy)
 
bitLenInt Compose (QInterfacePtr toCopy)
 Combine another QInterface with this one, after the last bit index of this one. More...
 
bitLenInt Compose (QUnitCliffordPtr toCopy, bitLenInt start)
 
bitLenInt Compose (QInterfacePtr toCopy, bitLenInt start)
 
void Decompose (bitLenInt start, QInterfacePtr dest)
 Minimally decompose a set of contiguous bits from the separably composed unit, into "destination". More...
 
void Decompose (bitLenInt start, QUnitCliffordPtr dest)
 
QInterfacePtr Decompose (bitLenInt start, bitLenInt length)
 Schmidt decompose a length of qubits. More...
 
void Dispose (bitLenInt start, bitLenInt length)
 Minimally decompose a set of contiguous bits from the separably composed unit, and discard the separable bits from index "start" for "length.". More...
 
void Dispose (bitLenInt start, bitLenInt length, bitCapInt disposedPerm)
 Dispose a a contiguous set of qubits that are already in a permutation eigenstate. More...
 
bitLenInt Allocate (bitLenInt start, bitLenInt length)
 Allocate new "length" count of |0> state qubits at specified qubit index start position. More...
 
void NormalizeState (real1_f nrm=REAL1_DEFAULT_ARG, real1_f norm_thresh=REAL1_DEFAULT_ARG, real1_f phaseArg=ZERO_R1_F)
 Apply the normalization factor found by UpdateRunningNorm() or on the fly by a single bit gate. More...
 
void UpdateRunningNorm (real1_f norm_thresh=REAL1_DEFAULT_ARG)
 Force a calculation of the norm of the state vector, in order to make it unit length before the next probability or measurement operation. More...
 
virtual real1_f SumSqrDiff (QInterfacePtr toCompare)
 
virtual real1_f SumSqrDiff (QUnitCliffordPtr toCompare)
 
bool ApproxCompare (QInterfacePtr toCompare, real1_f error_tol=TRYDECOMPOSE_EPSILON)
 Compare state vectors approximately, component by component, to determine whether this state vector is the same as the target. More...
 
bool ApproxCompare (QUnitCliffordPtr toCompare, real1_f error_tol=TRYDECOMPOSE_EPSILON)
 
real1_f Prob (bitLenInt qubit)
 Direct measure of bit probability to be in |1> state. More...
 
void Mtrx (const complex *mtrx, bitLenInt t)
 Apply an arbitrary single bit unitary transformation. More...
 
void Phase (complex topLeft, complex bottomRight, bitLenInt t)
 Apply a single bit transformation that only effects phase. More...
 
void Invert (complex topRight, complex bottomLeft, bitLenInt t)
 Apply a single bit transformation that reverses bit probability and might effect phase. More...
 
void MCPhase (const std::vector< bitLenInt > &controls, complex topLeft, complex bottomRight, bitLenInt t)
 Apply a single bit transformation that only effects phase, with arbitrary control bits. More...
 
void MACPhase (const std::vector< bitLenInt > &controls, complex topLeft, complex bottomRight, bitLenInt t)
 Apply a single bit transformation that only effects phase, with arbitrary (anti-)control bits. More...
 
void MCInvert (const std::vector< bitLenInt > &controls, complex topRight, complex bottomLeft, bitLenInt t)
 Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary control bits. More...
 
void MACInvert (const std::vector< bitLenInt > &controls, complex topRight, complex bottomLeft, bitLenInt t)
 Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary (anti-)control bits. More...
 
void MCMtrx (const std::vector< bitLenInt > &controls, const complex *mtrx, bitLenInt t)
 Apply an arbitrary single bit unitary transformation, with arbitrary control bits. More...
 
void MACMtrx (const std::vector< bitLenInt > &controls, const complex *mtrx, bitLenInt t)
 Apply an arbitrary single bit unitary transformation, with arbitrary (anti-)control bits. More...
 
void FSim (real1_f theta, real1_f phi, bitLenInt c, bitLenInt t)
 The 2-qubit "fSim" gate, (useful in the simulation of particles with fermionic statistics) More...
 
bool TrySeparate (const std::vector< bitLenInt > &qubits, real1_f ignored)
 Qrack::QUnit types maintain explicit separation of representations of qubits, which reduces memory usage and increases gate speed. More...
 
bool TrySeparate (bitLenInt qubit)
 Single-qubit TrySeparate() More...
 
bool TrySeparate (bitLenInt qubit1, bitLenInt qubit2)
 Two-qubit TrySeparate() More...
 
virtual void H (bitLenInt qubit)
 Apply a Hadamard gate to target. More...
 
virtual void H (bitLenInt start, bitLenInt length)
 Apply a Hadamard gate to target. More...
 
virtual void X (bitLenInt qubit)
 Apply an X (or NOT) gate to target. More...
 
virtual void X (bitLenInt start, bitLenInt length)
 Apply an X (or NOT) gate to target. More...
 
virtual bitLenInt Compose (QInterfacePtr toCopy)
 Combine another QInterface with this one, after the last bit index of this one. More...
 
virtual std::map< QInterfacePtr, bitLenIntCompose (std::vector< QInterfacePtr > toCopy)
 
virtual bitLenInt Compose (QInterfacePtr toCopy, bitLenInt start)
 
virtual bitLenInt Allocate (bitLenInt length)
 Allocate new "length" count of |0> state qubits at end of qubit index position. More...
 
virtual bitLenInt Allocate (bitLenInt start, bitLenInt length)=0
 Allocate new "length" count of |0> state qubits at specified qubit index start position. More...
 
- Public Member Functions inherited from Qrack::QInterface
 QInterface (bitLenInt n, qrack_rand_gen_ptr rgp=nullptr, bool doNorm=false, bool useHardwareRNG=true, bool randomGlobalPhase=true, real1_f norm_thresh=REAL1_EPSILON)
 
 QInterface ()
 Default constructor, primarily for protected internal use. More...
 
virtual ~QInterface ()
 
void SetRandomSeed (uint32_t seed)
 
virtual void SetConcurrency (uint32_t threadsPerEngine)
 Set the number of threads in parallel for loops, per component QEngine. More...
 
virtual bool GetIsArbitraryGlobalPhase ()
 
real1_f Rand ()
 Generate a random real number between 0 and 1. More...
 
virtual bitLenInt ComposeNoClone (QInterfacePtr toCopy)
 
virtual std::map< QInterfacePtr, bitLenIntCompose (std::vector< QInterfacePtr > toCopy)
 
virtual bitLenInt Allocate (bitLenInt length)
 Allocate new "length" count of |0> state qubits at end of qubit index position. More...
 
virtual void UCMtrx (const std::vector< bitLenInt > &controls, const complex *mtrx, bitLenInt target, bitCapInt controlPerm)
 Apply an arbitrary single bit unitary transformation, with arbitrary control bits, with arbitary control permutation. More...
 
virtual void UCPhase (const std::vector< bitLenInt > &controls, complex topLeft, complex bottomRight, bitLenInt target, bitCapInt perm)
 Apply a single bit transformation that only effects phase, with arbitrary control bits, with arbitrary control permutation. More...
 
virtual void UCInvert (const std::vector< bitLenInt > &controls, complex topRight, complex bottomLeft, bitLenInt target, bitCapInt perm)
 Apply a single bit transformation that reverses bit probability and might effect phase, with arbitrary control bits, with arbitrary control permutation. More...
 
virtual void UniformlyControlledSingleBit (const std::vector< bitLenInt > &controls, bitLenInt qubitIndex, const complex *mtrxs)
 Apply a "uniformly controlled" arbitrary single bit unitary transformation. More...
 
virtual void UniformlyControlledSingleBit (const std::vector< bitLenInt > &controls, bitLenInt qubitIndex, const complex *mtrxs, const std::vector< bitCapInt > &mtrxSkipPowers, bitCapInt mtrxSkipValueMask)
 
virtual void 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 CSwap (const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
 Apply a swap with arbitrary control bits. More...
 
virtual void AntiCSwap (const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
 Apply a swap with arbitrary (anti) control bits. More...
 
virtual void CSqrtSwap (const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
 Apply a square root of swap with arbitrary control bits. More...
 
virtual void AntiCSqrtSwap (const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
 Apply a square root of swap with arbitrary (anti) control bits. More...
 
virtual void CISqrtSwap (const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
 Apply an inverse square root of swap with arbitrary control bits. More...
 
virtual void AntiCISqrtSwap (const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
 Apply an inverse square root of swap with arbitrary (anti) control bits. More...
 
virtual void CCNOT (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Doubly-controlled NOT gate. More...
 
virtual void AntiCCNOT (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Anti doubly-controlled NOT gate. More...
 
virtual void CCY (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Doubly-Controlled Y gate. More...
 
virtual void AntiCCY (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Anti doubly-controlled Y gate. More...
 
virtual void CCZ (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Doubly-Controlled Z gate. More...
 
virtual void AntiCCZ (bitLenInt control1, bitLenInt control2, bitLenInt target)
 Anti doubly-controlled Z gate. More...
 
virtual void U (bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
 General unitary gate. More...
 
virtual void U2 (bitLenInt target, real1_f phi, real1_f lambda)
 2-parameter unitary gate More...
 
virtual void IU2 (bitLenInt target, real1_f phi, real1_f lambda)
 Inverse 2-parameter unitary gate. More...
 
virtual void AI (bitLenInt target, real1_f azimuth, real1_f inclination)
 "Azimuth, Inclination" (RY-RZ) More...
 
virtual void IAI (bitLenInt target, real1_f azimuth, real1_f inclination)
 Invert "Azimuth, Inclination" (RY-RZ) More...
 
virtual void CAI (bitLenInt control, bitLenInt target, real1_f azimuth, real1_f inclination)
 Controlled "Azimuth, Inclination" (RY-RZ) More...
 
virtual void AntiCAI (bitLenInt control, bitLenInt target, real1_f azimuth, real1_f inclination)
 (Anti-)Controlled "Azimuth, Inclination" (RY-RZ) More...
 
virtual void CIAI (bitLenInt control, bitLenInt target, real1_f azimuth, real1_f inclination)
 Controlled inverse "Azimuth, Inclination" (RY-RZ) More...
 
virtual void AntiCIAI (bitLenInt control, bitLenInt target, real1_f azimuth, real1_f inclination)
 (Anti-)Controlled inverse "Azimuth, Inclination" (RY-RZ) More...
 
virtual void CU (const std::vector< bitLenInt > &controls, bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
 Controlled general unitary gate. More...
 
virtual void AntiCU (const std::vector< bitLenInt > &controls, bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
 (Anti-)Controlled general unitary gate More...
 
virtual void SqrtH (bitLenInt qubit)
 Square root of Hadamard gate. More...
 
virtual void SH (bitLenInt qubit)
 Y-basis transformation gate. More...
 
virtual void HIS (bitLenInt qubit)
 Y-basis (inverse) transformation gate. More...
 
virtual bool M (bitLenInt qubitIndex)
 Measurement gate. More...
 
virtual void T (bitLenInt qubit)
 T gate. More...
 
virtual void IT (bitLenInt qubit)
 Inverse T gate. More...
 
virtual void PhaseRootN (bitLenInt n, bitLenInt qubit)
 "PhaseRootN" gate More...
 
virtual void IPhaseRootN (bitLenInt n, bitLenInt qubit)
 Inverse "PhaseRootN" gate. More...
 
virtual void PhaseParity (real1_f radians, bitCapInt mask)
 Parity phase gate. More...
 
virtual void XMask (bitCapInt mask)
 Masked X gate. More...
 
virtual void YMask (bitCapInt mask)
 Masked Y gate. More...
 
virtual void ZMask (bitCapInt mask)
 Masked Z gate. More...
 
virtual void SqrtX (bitLenInt qubit)
 Square root of X gate. More...
 
virtual void ISqrtX (bitLenInt qubit)
 Inverse square root of X gate. More...
 
virtual void SqrtY (bitLenInt qubit)
 Square root of Y gate. More...
 
virtual void ISqrtY (bitLenInt qubit)
 Inverse square root of Y gate. More...
 
virtual void SqrtW (bitLenInt qubit)
 Square root of W gate. More...
 
virtual void ISqrtW (bitLenInt qubit)
 Inverse square root of W gate. More...
 
virtual void CH (bitLenInt control, bitLenInt target)
 Controlled H gate. More...
 
virtual void AntiCH (bitLenInt control, bitLenInt target)
 (Anti-)controlled H gate More...
 
virtual void CS (bitLenInt control, bitLenInt target)
 Controlled S gate. More...
 
virtual void AntiCS (bitLenInt control, bitLenInt target)
 (Anti-)controlled S gate More...
 
virtual void CIS (bitLenInt control, bitLenInt target)
 Controlled inverse S gate. More...
 
virtual void AntiCIS (bitLenInt control, bitLenInt target)
 (Anti-)controlled inverse S gate More...
 
virtual void CT (bitLenInt control, bitLenInt target)
 Controlled T gate. More...
 
virtual void CIT (bitLenInt control, bitLenInt target)
 Controlled inverse T gate. More...
 
virtual void CPhaseRootN (bitLenInt n, bitLenInt control, bitLenInt target)
 Controlled "PhaseRootN" gate. More...
 
virtual void AntiCPhaseRootN (bitLenInt n, bitLenInt control, bitLenInt target)
 (Anti-)controlled "PhaseRootN" gate More...
 
virtual void CIPhaseRootN (bitLenInt n, bitLenInt control, bitLenInt target)
 Controlled inverse "PhaseRootN" gate. More...
 
virtual void AntiCIPhaseRootN (bitLenInt n, bitLenInt control, bitLenInt target)
 (Anti-)controlled inverse "PhaseRootN" gate More...
 
virtual void AND (bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
 Quantum analog of classical "AND" gate. More...
 
virtual void OR (bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
 Quantum analog of classical "OR" gate. More...
 
virtual void XOR (bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
 Quantum analog of classical "XOR" gate. More...
 
virtual void CLAND (bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
 Quantum analog of classical "AND" gate. More...
 
virtual void CLOR (bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
 Quantum analog of classical "OR" gate. More...
 
virtual void CLXOR (bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
 Quantum analog of classical "XOR" gate. More...
 
virtual void NAND (bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
 Quantum analog of classical "NAND" gate. More...
 
virtual void NOR (bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
 Quantum analog of classical "NOR" gate. More...
 
virtual void XNOR (bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
 Quantum analog of classical "XNOR" gate. More...
 
virtual void CLNAND (bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
 Quantum analog of classical "NAND" gate. More...
 
virtual void CLNOR (bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
 Quantum analog of classical "NOR" gate. More...
 
virtual void CLXNOR (bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
 Quantum analog of classical "XNOR" gate. More...
 
virtual void UniformlyControlledRY (const std::vector< bitLenInt > &controls, bitLenInt qubitIndex, real1 const *angles)
 Apply a "uniformly controlled" rotation of a bit around the Pauli Y axis. More...
 
virtual void UniformlyControlledRZ (const std::vector< bitLenInt > &controls, bitLenInt qubitIndex, real1 const *angles)
 Apply a "uniformly controlled" rotation of a bit around the Pauli Z axis. More...
 
virtual void RT (real1_f radians, bitLenInt qubitIndex)
 Phase shift gate. More...
 
virtual void RX (real1_f radians, bitLenInt qubitIndex)
 X axis rotation gate. More...
 
virtual void RY (real1_f radians, bitLenInt qubitIndex)
 Y axis rotation gate. More...
 
virtual void RZ (real1_f radians, bitLenInt qubitIndex)
 Z axis rotation gate. More...
 
virtual void CRZ (real1_f radians, bitLenInt control, bitLenInt target)
 Controlled Z axis rotation gate. More...
 
virtual void CRY (real1_f radians, bitLenInt control, bitLenInt target)
 Controlled Y axis rotation gate. More...
 
virtual void RTDyad (int numerator, int denomPower, bitLenInt qubitIndex)
 Dyadic fraction phase shift gate. More...
 
virtual void RXDyad (int numerator, int denomPower, bitLenInt qubitIndex)
 Dyadic fraction X axis rotation gate. More...
 
virtual void Exp (real1_f radians, bitLenInt qubitIndex)
 (Identity) Exponentiation gate More...
 
virtual void Exp (const std::vector< bitLenInt > &controls, bitLenInt qubit, const complex *matrix2x2, bool antiCtrled=false)
 Imaginary exponentiation of arbitrary 2x2 gate. More...
 
virtual void ExpDyad (int numerator, int denomPower, bitLenInt qubitIndex)
 Dyadic fraction (identity) exponentiation gate. More...
 
virtual void ExpX (real1_f radians, bitLenInt qubitIndex)
 Pauli X exponentiation gate. More...
 
virtual void ExpXDyad (int numerator, int denomPower, bitLenInt qubitIndex)
 Dyadic fraction Pauli X exponentiation gate. More...
 
virtual void ExpY (real1_f radians, bitLenInt qubitIndex)
 Pauli Y exponentiation gate. More...
 
virtual void ExpYDyad (int numerator, int denomPower, bitLenInt qubitIndex)
 Dyadic fraction Pauli Y exponentiation gate. More...
 
virtual void ExpZ (real1_f radians, bitLenInt qubitIndex)
 Pauli Z exponentiation gate. More...
 
virtual void ExpZDyad (int numerator, int denomPower, bitLenInt qubitIndex)
 Dyadic fraction Pauli Z exponentiation gate. More...
 
virtual void CRX (real1_f radians, bitLenInt control, bitLenInt target)
 Controlled X axis rotation gate. More...
 
virtual void CRXDyad (int numerator, int denomPower, bitLenInt control, bitLenInt target)
 Controlled dyadic fraction X axis rotation gate. More...
 
virtual void RYDyad (int numerator, int denomPower, bitLenInt qubitIndex)
 Dyadic fraction Y axis rotation gate. More...
 
virtual void CRYDyad (int numerator, int denomPower, bitLenInt control, bitLenInt target)
 Controlled dyadic fraction y axis rotation gate. More...
 
virtual void RZDyad (int numerator, int denomPower, bitLenInt qubitIndex)
 Dyadic fraction Z axis rotation gate. More...
 
virtual void CRZDyad (int numerator, int denomPower, bitLenInt control, bitLenInt target)
 Controlled dyadic fraction Z axis rotation gate. More...
 
virtual void CRT (real1_f radians, bitLenInt control, bitLenInt target)
 Controlled "phase shift gate". More...
 
virtual void CRTDyad (int numerator, int denomPower, bitLenInt control, bitLenInt target)
 Controlled dyadic fraction "phase shift gate". More...
 
virtual void H (bitLenInt start, bitLenInt length)
 Bitwise Hadamard. More...
 
virtual void X (bitLenInt start, bitLenInt length)
 Bitwise Pauli X (or logical "NOT") operator. More...
 
virtual void ROL (bitLenInt shift, bitLenInt start, bitLenInt length)
 Circular shift left - shift bits left, and carry last bits. More...
 
virtual void ROR (bitLenInt shift, bitLenInt start, bitLenInt length)
 Circular shift right - shift bits right, and carry first bits. More...
 
virtual void ASL (bitLenInt shift, bitLenInt start, bitLenInt length)
 Arithmetic shift left, with last 2 bits as sign and carry. More...
 
virtual void ASR (bitLenInt shift, bitLenInt start, bitLenInt length)
 Arithmetic shift right, with last 2 bits as sign and carry. More...
 
virtual void LSL (bitLenInt shift, bitLenInt start, bitLenInt length)
 Logical shift left, filling the extra bits with |0> More...
 
virtual void LSR (bitLenInt shift, bitLenInt start, bitLenInt length)
 Logical shift right, filling the extra bits with |0> More...
 
virtual void INCDECC (bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
 Common driver method behind INCC and DECC. More...
 
virtual void INCC (bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
 Add integer (without sign, with carry) More...
 
virtual void DECC (bitCapInt toSub, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
 Subtract classical integer (without sign, with carry) More...
 
virtual void INC (bitCapInt toAdd, bitLenInt start, bitLenInt length)
 Add integer (without sign) More...
 
virtual void CINC (bitCapInt toAdd, bitLenInt inOutStart, bitLenInt length, const std::vector< bitLenInt > &controls)
 Add integer (without sign, with controls) More...
 
virtual void INCS (bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex)
 Add a classical integer to the register, with sign and without carry. More...
 
virtual void DEC (bitCapInt toSub, bitLenInt start, bitLenInt length)
 Subtract classical integer (without sign) More...
 
virtual void CDEC (bitCapInt toSub, bitLenInt inOutStart, bitLenInt length, const std::vector< bitLenInt > &controls)
 Subtract classical integer (without sign, with controls) More...
 
virtual void DECS (bitCapInt toSub, bitLenInt start, bitLenInt length, bitLenInt overflowIndex)
 Subtract a classical integer from the register, with sign and without carry. More...
 
virtual void MULModNOut (bitCapInt toMul, bitCapInt modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length)
 Multiplication modulo N by integer, (out of place) More...
 
virtual void IMULModNOut (bitCapInt toMul, bitCapInt modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length)
 Inverse of multiplication modulo N by integer, (out of place) More...
 
virtual void CMULModNOut (bitCapInt toMul, bitCapInt modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length, const std::vector< bitLenInt > &controls)
 Controlled multiplication modulo N by integer, (out of place) More...
 
virtual void CIMULModNOut (bitCapInt toMul, bitCapInt modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length, const std::vector< bitLenInt > &controls)
 Inverse of controlled multiplication modulo N by integer, (out of place) More...
 
virtual void FullAdd (bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt carryInSumOut, bitLenInt carryOut)
 Quantum analog of classical "Full Adder" gate. More...
 
virtual void IFullAdd (bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt carryInSumOut, bitLenInt carryOut)
 Inverse of FullAdd. More...
 
virtual void CFullAdd (const std::vector< bitLenInt > &controls, bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt carryInSumOut, bitLenInt carryOut)
 Controlled quantum analog of classical "Full Adder" gate. More...
 
virtual void CIFullAdd (const std::vector< bitLenInt > &controls, bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt carryInSumOut, bitLenInt carryOut)
 Inverse of CFullAdd. More...
 
virtual void ADC (bitLenInt input1, bitLenInt input2, bitLenInt output, bitLenInt length, bitLenInt carry)
 Add a quantum integer to a quantum integer, with carry. More...
 
virtual void IADC (bitLenInt input1, bitLenInt input2, bitLenInt output, bitLenInt length, bitLenInt carry)
 Inverse of ADC. More...
 
virtual void CADC (const std::vector< bitLenInt > &controls, bitLenInt input1, bitLenInt input2, bitLenInt output, bitLenInt length, bitLenInt carry)
 Add a quantum integer to a quantum integer, with carry and with controls. More...
 
virtual void CIADC (const std::vector< bitLenInt > &controls, bitLenInt input1, bitLenInt input2, bitLenInt output, bitLenInt length, bitLenInt carry)
 Inverse of CADC. More...
 
virtual void QFT (bitLenInt start, bitLenInt length, bool trySeparate=false)
 Quantum Fourier Transform - Apply the quantum Fourier transform to the register. More...
 
virtual void QFTR (const std::vector< bitLenInt > &qubits, bool trySeparate=false)
 Quantum Fourier Transform (random access) - Apply the quantum Fourier transform to the register. More...
 
virtual void IQFT (bitLenInt start, bitLenInt length, bool trySeparate=false)
 Inverse Quantum Fourier Transform - Apply the inverse quantum Fourier transform to the register. More...
 
virtual void IQFTR (const std::vector< bitLenInt > &qubits, bool trySeparate=false)
 Inverse Quantum Fourier Transform (random access) - Apply the inverse quantum Fourier transform to the register. More...
 
virtual void ZeroPhaseFlip (bitLenInt start, bitLenInt length)
 Reverse the phase of the state where the register equals zero. More...
 
virtual void PhaseFlip ()
 Phase flip always - equivalent to Z X Z X on any bit in the QInterface. More...
 
virtual void SetReg (bitLenInt start, bitLenInt length, bitCapInt value)
 Set register bits to given permutation. More...
 
virtual bitCapInt MReg (bitLenInt start, bitLenInt length)
 Measure permutation state of a register. More...
 
virtual bitCapInt 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 M (const std::vector< bitLenInt > &bits)
 Measure bits with indices in array, and return a mask of the results. More...
 
virtual bitCapInt ForceM (const std::vector< bitLenInt > &bits, const std::vector< bool > &values, bool doApply=true)
 Measure bits with indices in array, and return a mask of the results. More...
 
virtual void SqrtSwap (bitLenInt qubitIndex1, bitLenInt qubitIndex2)
 Square root of Swap gate. More...
 
virtual void ISqrtSwap (bitLenInt qubitIndex1, bitLenInt qubitIndex2)
 Inverse square root of Swap gate. More...
 
virtual void Reverse (bitLenInt first, bitLenInt last)
 Reverse all of the bits in a sequence. More...
 
virtual real1_f CProb (bitLenInt control, bitLenInt target)
 Direct measure of bit probability to be in |1> state, if control bit is |1>. More...
 
virtual real1_f ACProb (bitLenInt control, bitLenInt target)
 Direct measure of bit probability to be in |1> state, if control bit is |0>. More...
 
virtual real1_f ProbAll (bitCapInt fullRegister)
 Direct measure of full permutation probability. More...
 
virtual real1_f ProbReg (bitLenInt start, bitLenInt length, bitCapInt permutation)
 Direct measure of register permutation probability. More...
 
virtual void ProbMaskAll (bitCapInt mask, real1 *probsArray)
 Direct measure of masked permutation probability. More...
 
virtual void ProbBitsAll (const std::vector< bitLenInt > &bits, real1 *probsArray)
 Direct measure of listed permutation probability. More...
 
virtual real1_f ExpectationBitsAll (const std::vector< bitLenInt > &bits, bitCapInt offset=0U)
 Get permutation expectation value of bits. More...
 
virtual real1_f ExpectationBitsFactorizedRdm (bool roundRz, const std::vector< bitLenInt > &bits, const std::vector< bitCapInt > &perms, bitCapInt offset=0)
 Get (reduced density matrix) expectation value of bits, given an array of qubit weights. More...
 
virtual real1_f ExpectationFloatsFactorizedRdm (bool roundRz, const std::vector< bitLenInt > &bits, const std::vector< real1_f > &weights)
 Get (reduced density matrix) expectation value of bits, given a (floating-point) array of qubit weights. More...
 
virtual real1_f ProbRdm (bitLenInt qubitIndex)
 Direct measure of bit probability to be in |1> state, treating all ancillary qubits as post-selected T gate gadgets. More...
 
virtual real1_f ProbAllRdm (bool roundRz, bitCapInt fullRegister)
 Direct measure of full permutation probability, treating all ancillary qubits as post-selected T gate gadgets. More...
 
virtual real1_f ProbMaskRdm (bool roundRz, bitCapInt mask, bitCapInt permutation)
 Direct measure of masked permutation probability, treating all ancillary qubits as post-selected T gate gadgets. More...
 
virtual real1_f ExpectationBitsAllRdm (bool roundRz, const std::vector< bitLenInt > &bits, bitCapInt offset=0U)
 Get permutation expectation value of bits, treating all ancillary qubits as post-selected T gate gadgets. More...
 
virtual void SetBit (bitLenInt qubit, bool value)
 Set individual bit to pure |0> (false) or |1> (true) state. More...
 
virtual bool TryDecompose (bitLenInt start, QInterfacePtr dest, real1_f error_tol=TRYDECOMPOSE_EPSILON)
 
virtual void Finish ()
 If asynchronous work is still running, block until it finishes. More...
 
virtual bool isFinished ()
 Returns "false" if asynchronous work is still running, and "true" if all previously dispatched asynchronous work is done. More...
 
virtual void Dump ()
 If asynchronous work is still running, let the simulator know that it can be aborted. More...
 
virtual bool isBinaryDecisionTree ()
 Returns "true" if current state representation is definitely a binary decision tree, "false" if it is definitely not, or "true" if it cannot be determined. More...
 
virtual bool isOpenCL ()
 Returns "true" if current simulation is OpenCL-based. More...
 
virtual double GetUnitaryFidelity ()
 When "Schmidt-decomposition rounding parameter" ("SDRP") is being used, starting from initial 1.0 fidelity, we compound the "unitary fidelity" by successive multiplication by one minus two times the true unitary probability discarded in each single rounding event. More...
 
virtual void ResetUnitaryFidelity ()
 Reset the internal fidelity calculation tracker to 1.0. More...
 
virtual void SetSdrp (real1_f sdrp)
 Set the "Schmidt decomposition rounding parameter" value, (between 0 and 1) More...
 
virtual void SetReactiveSeparate (bool isAggSep)
 Set reactive separation option (on by default if available) More...
 
virtual bool GetReactiveSeparate ()
 Get reactive separation option. More...
 
virtual void SetTInjection (bool useGadget)
 Set the option to use T-injection gadgets (off by default) More...
 
virtual bool GetTInjection ()
 Get the option to use T-injection gadgets. More...
 
virtual int64_t GetDevice ()
 Get the device index. More...
 
bitCapIntOcl GetMaxSize ()
 Get maximum number of amplitudes that can be allocated on current device. More...
 
virtual real1_f FirstNonzeroPhase ()
 Get phase of lowest permutation nonzero amplitude. More...
 
virtual void DepolarizingChannelWeak1Qb (bitLenInt qubit, real1_f lambda)
 Simulate a local qubit depolarizing noise channel, under a stochastic "weak simulation condition." Under "weak" condition, sampling and exact state queries are not accurate, but sampling can be achieved via repeated full execution of a noisy circuit, for each hardware-realistic measurement sample. More...
 
virtual bitLenInt DepolarizingChannelStrong1Qb (bitLenInt qubit, real1_f lambda)
 Simulate a local qubit depolarizing noise channel, under a "strong simulation condition." "Strong" condition supports measurement sampling and direct queries of state, but the expression of state is in terms of one retained ancillary qubit per applied noise channel. More...
 
- Public Member Functions inherited from Qrack::ParallelFor
 ParallelFor ()
 
void SetConcurrencyLevel (unsigned num)
 
unsigned GetConcurrencyLevel ()
 
bitCapIntOcl GetStride ()
 
bitLenInt GetPreferredConcurrencyPower ()
 
void par_for_inc (const bitCapIntOcl begin, const bitCapIntOcl itemCount, IncrementFunc, ParallelFunc fn)
 Iterate through the permutations a maximum of end-begin times, allowing the caller to control the incrementation offset through 'inc'. More...
 
void par_for (const bitCapIntOcl begin, const bitCapIntOcl end, ParallelFunc fn)
 Call fn once for every numerical value between begin and end. More...
 
void par_for_skip (const bitCapIntOcl begin, const bitCapIntOcl end, const bitCapIntOcl skipPower, const bitLenInt skipBitCount, ParallelFunc fn)
 Skip over the skipPower bits. More...
 
void par_for_mask (const bitCapIntOcl, const bitCapIntOcl, const std::vector< bitCapIntOcl > &maskArray, ParallelFunc fn)
 Skip over the bits listed in maskArray in the same fashion as par_for_skip. More...
 
void par_for_set (const std::set< bitCapIntOcl > &sparseSet, ParallelFunc fn)
 Iterate over a sparse state vector. More...
 
void par_for_set (const std::vector< bitCapIntOcl > &sparseSet, ParallelFunc fn)
 Iterate over a sparse state vector. More...
 
void par_for_sparse_compose (const std::vector< bitCapIntOcl > &lowSet, const std::vector< bitCapIntOcl > &highSet, const bitLenInt &highStart, ParallelFunc fn)
 Iterate over the power set of 2 sparse state vectors. More...
 
real1_f par_norm (const bitCapIntOcl maxQPower, const StateVectorPtr stateArray, real1_f norm_thresh=ZERO_R1_F)
 Calculate the normal for the array, (with flooring). More...
 
real1_f par_norm_exact (const bitCapIntOcl maxQPower, const StateVectorPtr stateArray)
 Calculate the normal for the array, (without flooring.) More...
 

Protected Types

typedef std::function< void(QStabilizerPtr unit, const bitLenInt &c, const bitLenInt &t, const complex *mtrx)> CGateFn
 

Protected Member Functions

void CombinePhaseOffsets (QStabilizerPtr unit)
 
void SortUnit (QStabilizerPtr unit, std::vector< QSortEntry > &bits, bitLenInt low, bitLenInt high)
 
void Detach (bitLenInt start, bitLenInt length, QUnitCliffordPtr dest)
 
QStabilizerPtr EntangleInCurrentBasis (std::vector< bitLenInt * >::iterator first, std::vector< bitLenInt * >::iterator last)
 
QStabilizerPtr EntangleAll ()
 
void OrderContiguous (QStabilizerPtr unit)
 
void CGate (bitLenInt control, bitLenInt target, const complex *mtrx, CGateFn fn)
 
QInterfacePtr CloneBody (QUnitCliffordPtr copyPtr)
 
bool SeparateBit (bool value, bitLenInt qubit)
 
void ThrowIfQubitInvalid (bitLenInt t, std::string methodName)
 
bitLenInt ThrowIfQubitSetInvalid (const std::vector< bitLenInt > &controls, bitLenInt t, std::string methodName)
 
- Protected Member Functions inherited from Qrack::QInterface
virtual void SetQubitCount (bitLenInt qb)
 
complex GetNonunitaryPhase ()
 
template<typename Fn >
void MACWrapper (const std::vector< bitLenInt > &controls, Fn fn)
 
bitCapInt SampleClone (const std::vector< bitCapInt > &qPowers)
 

Protected Attributes

complex phaseOffset
 
std::vector< CliffordShardshards
 
- Protected Attributes inherited from Qrack::QInterface
bool doNormalize
 
bool randGlobalPhase
 
bool useRDRAND
 
bitLenInt qubitCount
 
uint32_t randomSeed
 
real1 amplitudeFloor
 
bitCapInt maxQPower
 
qrack_rand_gen_ptr rand_generator
 
std::uniform_real_distribution< real1_srand_distribution
 
std::shared_ptr< RdRandomhardware_rand_generator
 

Friends

std::ostream & operator<< (std::ostream &os, const QUnitCliffordPtr s)
 
std::istream & operator>> (std::istream &is, const QUnitCliffordPtr s)
 

Additional Inherited Members

- Static Protected Member Functions inherited from Qrack::QInterface
static real1_f normHelper (complex c)
 
static real1_f clampProb (real1_f toClamp)
 

Member Typedef Documentation

◆ CGateFn

typedef std::function<void(QStabilizerPtr unit, const bitLenInt& c, const bitLenInt& t, const complex* mtrx)> Qrack::QUnitClifford::CGateFn
protected

Constructor & Destructor Documentation

◆ QUnitClifford()

Qrack::QUnitClifford::QUnitClifford ( bitLenInt  n,
bitCapInt  perm = 0U,
qrack_rand_gen_ptr  rgp = nullptr,
complex  phasFac = CMPLX_DEFAULT_ARG,
bool  doNorm = false,
bool  randomGlobalPhase = true,
bool  ignored2 = false,
int64_t  ignored3 = -1,
bool  useHardwareRNG = true,
bool  ignored4 = false,
real1_f  ignored5 = REAL1_EPSILON,
std::vector< int64_t >  ignored6 = {},
bitLenInt  ignored7 = 0U,
real1_f  ignored8 = FP_NORM_EPSILON_F 
)

◆ ~QUnitClifford()

Qrack::QUnitClifford::~QUnitClifford ( )
inline

Member Function Documentation

◆ Allocate() [1/3]

virtual bitLenInt Qrack::QInterface::Allocate
inline

Allocate new "length" count of |0> state qubits at end of qubit index position.

◆ Allocate() [2/3]

bitLenInt Qrack::QUnitClifford::Allocate ( bitLenInt  start,
bitLenInt  length 
)
inlinevirtual

Allocate new "length" count of |0> state qubits at specified qubit index start position.

Implements Qrack::QInterface.

◆ Allocate() [3/3]

virtual bitLenInt Qrack::QInterface::Allocate

Allocate new "length" count of |0> state qubits at specified qubit index start position.

◆ AntiCNOT()

void Qrack::QUnitClifford::AntiCNOT ( bitLenInt  c,
bitLenInt  t 
)
inlinevirtual

Apply an (anti-)CNOT gate with control and target.

Reimplemented from Qrack::QInterface.

◆ AntiCY()

void Qrack::QUnitClifford::AntiCY ( bitLenInt  c,
bitLenInt  t 
)
inlinevirtual

Apply an (anti-)CY gate with control and target.

Reimplemented from Qrack::QInterface.

◆ AntiCZ()

void Qrack::QUnitClifford::AntiCZ ( bitLenInt  c,
bitLenInt  t 
)
inlinevirtual

Apply an (anti-)CZ gate with control and target.

Reimplemented from Qrack::QInterface.

◆ ApproxCompare() [1/2]

bool Qrack::QUnitClifford::ApproxCompare ( QInterfacePtr  toCompare,
real1_f  error_tol = TRYDECOMPOSE_EPSILON 
)
inlinevirtual

Compare state vectors approximately, component by component, to determine whether this state vector is the same as the target.

Warning
PSEUDO-QUANTUM

Reimplemented from Qrack::QInterface.

◆ ApproxCompare() [2/2]

bool Qrack::QUnitClifford::ApproxCompare ( QUnitCliffordPtr  toCompare,
real1_f  error_tol = TRYDECOMPOSE_EPSILON 
)
inline

◆ CanDecomposeDispose()

bool Qrack::QUnitClifford::CanDecomposeDispose ( const bitLenInt  start,
const bitLenInt  length 
)
inline

◆ CGate()

void Qrack::QUnitClifford::CGate ( bitLenInt  control,
bitLenInt  target,
const complex mtrx,
CGateFn  fn 
)
inlineprotected

◆ Clear()

void Qrack::QUnitClifford::Clear ( )
inline

◆ Clone()

QInterfacePtr Qrack::QUnitClifford::Clone ( )
inlinevirtual

Clone this QInterface.

Implements Qrack::QInterface.

◆ CloneBody()

QInterfacePtr Qrack::QUnitClifford::CloneBody ( QUnitCliffordPtr  copyPtr)
protected

◆ CloneEmpty()

QUnitCliffordPtr Qrack::QUnitClifford::CloneEmpty ( )
inline

◆ CNOT()

void Qrack::QUnitClifford::CNOT ( bitLenInt  c,
bitLenInt  t 
)
inlinevirtual

Apply a CNOT gate with control and target.

Reimplemented from Qrack::QInterface.

◆ CombinePhaseOffsets()

void Qrack::QUnitClifford::CombinePhaseOffsets ( QStabilizerPtr  unit)
inlineprotected

◆ Compose() [1/7]

virtual bitLenInt Qrack::QInterface::Compose
inline

Combine another QInterface with this one, after the last bit index of this one.

"Compose" combines the quantum description of state of two independent QInterface objects into one object, containing the full permutation basis of the full object. The "inputState" bits are added after the last qubit index of the QInterface to which we "Compose." Informally, "Compose" is equivalent to "just setting another group of qubits down next to the first" without interacting them. Schroedinger's equation can form a description of state for two independent subsystems at once or "separable quantum subsystems" without interacting them. Once the description of state of the independent systems is combined, we can interact them, and we can describe their entanglements to each other, in which case they are no longer independent. A full entangled description of quantum state is not possible for two independent quantum subsystems until we "Compose" them.

"Compose" multiplies the probabilities of the indepedent permutation states of the two subsystems to find the probabilites of the entire set of combined permutations, by simple combinatorial reasoning. If the probablity of the "left-hand" subsystem being in |00> is 1/4, and the probablity of the "right-hand" subsystem being in |101> is 1/8, than the probability of the combined |00101> permutation state is 1/32, and so on for all permutations of the new combined state.

If the programmer doesn't want to "cheat" quantum mechanically, then the original copy of the state which is duplicated into the larger QInterface should be "thrown away" to satisfy "no clone theorem." This is not semantically enforced in Qrack, because optimization of an emulator might be acheived by "cloning" "under-the-hood" while only exposing a quantum mechanically consistent API or instruction set.

Returns the quantum bit offset that the QInterface was appended at, such that bit 5 in toCopy is equal to offset+5 in this object.

◆ Compose() [2/7]

bitLenInt Qrack::QUnitClifford::Compose ( QInterfacePtr  toCopy)
inlinevirtual

Combine another QInterface with this one, after the last bit index of this one.

"Compose" combines the quantum description of state of two independent QInterface objects into one object, containing the full permutation basis of the full object. The "inputState" bits are added after the last qubit index of the QInterface to which we "Compose." Informally, "Compose" is equivalent to "just setting another group of qubits down next to the first" without interacting them. Schroedinger's equation can form a description of state for two independent subsystems at once or "separable quantum subsystems" without interacting them. Once the description of state of the independent systems is combined, we can interact them, and we can describe their entanglements to each other, in which case they are no longer independent. A full entangled description of quantum state is not possible for two independent quantum subsystems until we "Compose" them.

"Compose" multiplies the probabilities of the indepedent permutation states of the two subsystems to find the probabilites of the entire set of combined permutations, by simple combinatorial reasoning. If the probablity of the "left-hand" subsystem being in |00> is 1/4, and the probablity of the "right-hand" subsystem being in |101> is 1/8, than the probability of the combined |00101> permutation state is 1/32, and so on for all permutations of the new combined state.

If the programmer doesn't want to "cheat" quantum mechanically, then the original copy of the state which is duplicated into the larger QInterface should be "thrown away" to satisfy "no clone theorem." This is not semantically enforced in Qrack, because optimization of an emulator might be acheived by "cloning" "under-the-hood" while only exposing a quantum mechanically consistent API or instruction set.

Returns the quantum bit offset that the QInterface was appended at, such that bit 5 in toCopy is equal to offset+5 in this object.

Reimplemented from Qrack::QInterface.

◆ Compose() [3/7]

bitLenInt Qrack::QInterface::Compose

◆ Compose() [4/7]

bitLenInt Qrack::QUnitClifford::Compose ( QInterfacePtr  toCopy,
bitLenInt  start 
)
inlinevirtual

Reimplemented from Qrack::QInterface.

◆ Compose() [5/7]

bitLenInt Qrack::QUnitClifford::Compose ( QUnitCliffordPtr  toCopy)
inline

◆ Compose() [6/7]

bitLenInt Qrack::QUnitClifford::Compose ( QUnitCliffordPtr  toCopy,
bitLenInt  start 
)
inline

◆ Compose() [7/7]

std::map< QInterfacePtr, bitLenInt > Qrack::QInterface::Compose

◆ CY()

void Qrack::QUnitClifford::CY ( bitLenInt  c,
bitLenInt  t 
)
inlinevirtual

Apply a CY gate with control and target.

Reimplemented from Qrack::QInterface.

◆ CZ()

void Qrack::QUnitClifford::CZ ( bitLenInt  c,
bitLenInt  t 
)
inlinevirtual

Apply a CZ gate with control and target.

Reimplemented from Qrack::QInterface.

◆ Decompose() [1/3]

QInterfacePtr Qrack::QUnitClifford::Decompose ( bitLenInt  start,
bitLenInt  length 
)
inlinevirtual

Schmidt decompose a length of qubits.

Implements Qrack::QInterface.

◆ Decompose() [2/3]

void Qrack::QUnitClifford::Decompose ( bitLenInt  start,
QInterfacePtr  dest 
)
inlinevirtual

Minimally decompose a set of contiguous bits from the separably composed unit, into "destination".

Minimally decompose a set of contigious bits from the separably composed unit. The length of this separable unit is reduced by the length of bits decomposed, and the bits removed are output in the destination QInterface pointer. The destination object must be initialized to the correct number of bits, in 0 permutation state. For quantum mechanical accuracy, the bit set removed and the bit set left behind should be quantum mechanically "separable."

Like how "Compose" is like "just setting another group of qubits down next to the first," if two sets of qubits are not entangled, then "Decompose" is like "just moving a few qubits away from the rest." Schroedinger's equation does not require bits to be explicitly interacted in order to describe their permutation basis, and the descriptions of state of separable subsystems, those which are not entangled with other subsystems, are just as easily removed from the description of state. (This is equivalent to a "Schmidt decomposition.")

If we have for example 5 qubits, and we wish to separate into "left" and "right" subsystems of 3 and 2 qubits, we sum probabilities of one permutation of the "left" three over ALL permutations of the "right" two, for all permutations, and vice versa, like so:

\( P(|1000>|xy>) = P(|1000 00>) + P(|1000 10>) + P(|1000 01>) + P(|1000 11>). \)

If the subsystems are not "separable," i.e. if they are entangled, this operation is not well-motivated, and its output is not necessarily defined. (The summing of probabilities over permutations of subsytems will be performed as described above, but this is not quantum mechanically meaningful.) To ensure that the subsystem is "separable," i.e. that it has no entanglements to other subsystems in the QInterface, it can be measured with M(), or else all qubits other than the subsystem can be measured.

Implements Qrack::QInterface.

◆ Decompose() [3/3]

void Qrack::QUnitClifford::Decompose ( bitLenInt  start,
QUnitCliffordPtr  dest 
)
inline

◆ Detach()

void Qrack::QUnitClifford::Detach ( bitLenInt  start,
bitLenInt  length,
QUnitCliffordPtr  dest 
)
protected

◆ Dispose() [1/2]

void Qrack::QUnitClifford::Dispose ( bitLenInt  start,
bitLenInt  length 
)
inlinevirtual

Minimally decompose a set of contiguous bits from the separably composed unit, and discard the separable bits from index "start" for "length.".

Minimally decompose a set of contigious bits from the separably composed unit. The length of this separable unit is reduced by the length of bits decomposed, and the bits removed are output in the destination QInterface pointer. The destination object must be initialized to the correct number of bits, in 0 permutation state. For quantum mechanical accuracy, the bit set removed and the bit set left behind should be quantum mechanically "separable."

Like how "Compose" is like "just setting another group of qubits down next to the first," if two sets of qubits are not entangled, then "Decompose" is like "just moving a few qubits away from the rest." Schroedinger's equation does not require bits to be explicitly interacted in order to describe their permutation basis, and the descriptions of state of separable subsystems, those which are not entangled with other subsystems, are just as easily removed from the description of state. (This is equivalent to a "Schmidt decomposition.")

If we have for example 5 qubits, and we wish to separate into "left" and "right" subsystems of 3 and 2 qubits, we sum probabilities of one permutation of the "left" three over ALL permutations of the "right" two, for all permutations, and vice versa, like so:

\( P(|1000>|xy>) = P(|1000 00>) + P(|1000 10>) + P(|1000 01>) + P(|1000 11>). \)

If the subsystems are not "separable," i.e. if they are entangled, this operation is not well-motivated, and its output is not necessarily defined. (The summing of probabilities over permutations of subsytems will be performed as described above, but this is not quantum mechanically meaningful.) To ensure that the subsystem is "separable," i.e. that it has no entanglements to other subsystems in the QInterface, it can be measured with M(), or else all qubits other than the subsystem can be measured.

Implements Qrack::QInterface.

◆ Dispose() [2/2]

void Qrack::QUnitClifford::Dispose ( bitLenInt  start,
bitLenInt  length,
bitCapInt  disposedPerm 
)
inlinevirtual

Dispose a a contiguous set of qubits that are already in a permutation eigenstate.

Implements Qrack::QInterface.

◆ EntangleAll()

QStabilizerPtr Qrack::QUnitClifford::EntangleAll ( )
inlineprotected

◆ EntangleInCurrentBasis()

QStabilizerPtr Qrack::QUnitClifford::EntangleInCurrentBasis ( std::vector< bitLenInt * >::iterator  first,
std::vector< bitLenInt * >::iterator  last 
)
protected

◆ ExpectationBitsFactorized()

real1_f Qrack::QUnitClifford::ExpectationBitsFactorized ( const std::vector< bitLenInt > &  bits,
const std::vector< bitCapInt > &  perms,
bitCapInt  offset = 0U 
)
virtual

Get expectation value of bits, given an array of qubit weights.

The weighter-per-qubit expectation value of is returned, with each "bits" entry corresponding to a "perms" weight entry.

Warning
PSEUDO-QUANTUM

Reimplemented from Qrack::QInterface.

◆ ExpectationFloatsFactorized()

real1_f Qrack::QUnitClifford::ExpectationFloatsFactorized ( const std::vector< bitLenInt > &  bits,
const std::vector< real1_f > &  weights 
)
virtual

Get expectation value of bits, given a (floating-point) array of qubit weights.

The weighter-per-qubit expectation value of is returned, with each "bits" entry corresponding to a "weights" entry.

Warning
PSEUDO-QUANTUM

Reimplemented from Qrack::QInterface.

◆ ForceM()

bool Qrack::QUnitClifford::ForceM ( bitLenInt  t,
bool  result,
bool  doForce = true,
bool  doApply = true 
)
virtual

Measure qubit t.

Implements Qrack::QInterface.

◆ FSim()

void Qrack::QUnitClifford::FSim ( real1_f  theta,
real1_f  phi,
bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
inlinevirtual

The 2-qubit "fSim" gate, (useful in the simulation of particles with fermionic statistics)

Implements Qrack::QInterface.

◆ GetAmplitude()

complex Qrack::QUnitClifford::GetAmplitude ( bitCapInt  perm)
virtual

Get a single basis state amplitude.

Convert the state to ket notation (warning: could be huge!)

Implements Qrack::QInterface.

◆ GetAmplitudes()

std::vector< complex > Qrack::QUnitClifford::GetAmplitudes ( std::vector< bitCapInt perms)

Get a single basis state amplitude.

Convert the state to ket notation (warning: could be huge!)

◆ GetMaxQPower()

bitCapInt Qrack::QUnitClifford::GetMaxQPower ( )
inlinevirtual

Get the maximum number of basis states, namely \( 2^n \) for \( n \) qubits.

Reimplemented from Qrack::QInterface.

◆ GetPhaseOffset()

complex Qrack::QUnitClifford::GetPhaseOffset ( )
inline

◆ GetProbs()

void Qrack::QUnitClifford::GetProbs ( real1 outputProbs)
virtual

Get all probabilities corresponding to ket notation.

Implements Qrack::QInterface.

◆ GetQuantumState() [1/3]

std::map< bitCapInt, complex > Qrack::QUnitClifford::GetQuantumState ( )

Convert the state to sparse ket notation.

Convert the state to ket notation (warning: could be huge!)

◆ GetQuantumState() [2/3]

void Qrack::QUnitClifford::GetQuantumState ( complex stateVec)
virtual

Convert the state to ket notation.

Convert the state to ket notation (warning: could be huge!)

Implements Qrack::QInterface.

◆ GetQuantumState() [3/3]

void Qrack::QUnitClifford::GetQuantumState ( QInterfacePtr  eng)

Convert the state to ket notation, directly into another QInterface.

Convert the state to ket notation (warning: could be huge!)

◆ GetQubitCount()

bitLenInt Qrack::QUnitClifford::GetQubitCount ( )
inlinevirtual

Get the count of bits in this register.

Reimplemented from Qrack::QInterface.

◆ H() [1/3]

virtual void Qrack::QInterface::H
inline

Apply a Hadamard gate to target.

◆ H() [2/3]

virtual void Qrack::QInterface::H

Apply a Hadamard gate to target.

◆ H() [3/3]

void Qrack::QUnitClifford::H ( bitLenInt  qubit)
inlinevirtual

Hadamard gate.

Applies a Hadamard gate on qubit at "qubitIndex."

Reimplemented from Qrack::QInterface.

◆ IISwap()

void Qrack::QUnitClifford::IISwap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
inlinevirtual

Inverse ISwap - Swap values of two bits in register, and apply phase factor of -i if bits are different.

Reimplemented from Qrack::QInterface.

◆ Invert()

void Qrack::QUnitClifford::Invert ( complex  topRight,
complex  bottomLeft,
bitLenInt  qubitIndex 
)
inlinevirtual

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

Reimplemented from Qrack::QInterface.

◆ IS()

void Qrack::QUnitClifford::IS ( bitLenInt  t)
inlinevirtual

Apply an inverse phase gate (|0>->|0>, |1>->-i|1>, or "S adjoint") to qubit b.

Reimplemented from Qrack::QInterface.

◆ isClifford() [1/2]

bool Qrack::QUnitClifford::isClifford ( )
inlinevirtual

Returns "true" if current state is identifiably within the Clifford set, or "false" if it is not or cannot be determined.

Reimplemented from Qrack::QInterface.

◆ isClifford() [2/2]

bool Qrack::QUnitClifford::isClifford ( bitLenInt  qubit)
inlinevirtual

Returns "true" if current qubit state is identifiably within the Clifford set, or "false" if it is not or cannot be determined.

Reimplemented from Qrack::QInterface.

◆ IsSeparable()

uint8_t Qrack::QUnitClifford::IsSeparable ( const bitLenInt t)
inline

Returns: 0 if target qubit is not separable 1 if target qubit is a Z basis eigenstate 2 if target qubit is an X basis eigenstate 3 if target qubit is a Y basis eigenstate.

◆ IsSeparableX()

bool Qrack::QUnitClifford::IsSeparableX ( const bitLenInt t)
inline

Returns "true" if target qubit is an X basis eigenstate.

◆ IsSeparableY()

bool Qrack::QUnitClifford::IsSeparableY ( const bitLenInt t)
inline

Returns "true" if target qubit is a Y basis eigenstate.

◆ IsSeparableZ()

bool Qrack::QUnitClifford::IsSeparableZ ( const bitLenInt t)
inline

Returns "true" if target qubit is a Z basis eigenstate.

◆ ISwap()

void Qrack::QUnitClifford::ISwap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
inlinevirtual

Swap values of two bits in register, and apply phase factor of i if bits are different.

Reimplemented from Qrack::QInterface.

◆ MACInvert()

void Qrack::QUnitClifford::MACInvert ( const std::vector< bitLenInt > &  controls,
complex  topRight,
complex  bottomLeft,
bitLenInt  target 
)
inlinevirtual

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

Reimplemented from Qrack::QInterface.

◆ MACMtrx()

void Qrack::QUnitClifford::MACMtrx ( const std::vector< bitLenInt > &  controls,
const complex mtrx,
bitLenInt  target 
)
inlinevirtual

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

Reimplemented from Qrack::QInterface.

◆ MACPhase()

void Qrack::QUnitClifford::MACPhase ( const std::vector< bitLenInt > &  controls,
complex  topLeft,
complex  bottomRight,
bitLenInt  target 
)
inlinevirtual

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

Reimplemented from Qrack::QInterface.

◆ MakeStabilizer()

QStabilizerPtr Qrack::QUnitClifford::MakeStabilizer ( bitLenInt  length = 1U,
bitCapInt  perm = 0U,
complex  phaseFac = CMPLX_DEFAULT_ARG 
)
inline

◆ MAll()

bitCapInt Qrack::QUnitClifford::MAll ( )
inlinevirtual

Measure all qubits.

Reimplemented from Qrack::QInterface.

◆ MCInvert()

void Qrack::QUnitClifford::MCInvert ( const std::vector< bitLenInt > &  controls,
complex  topRight,
complex  bottomLeft,
bitLenInt  target 
)
inlinevirtual

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

Reimplemented from Qrack::QInterface.

◆ MCMtrx()

void Qrack::QUnitClifford::MCMtrx ( const std::vector< bitLenInt > &  controls,
const complex mtrx,
bitLenInt  target 
)
inlinevirtual

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

Implements Qrack::QInterface.

◆ MCPhase()

void Qrack::QUnitClifford::MCPhase ( const std::vector< bitLenInt > &  controls,
complex  topLeft,
complex  bottomRight,
bitLenInt  target 
)
inlinevirtual

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

Reimplemented from Qrack::QInterface.

◆ Mtrx()

void Qrack::QUnitClifford::Mtrx ( const complex mtrx,
bitLenInt  qubitIndex 
)
inlinevirtual

Apply an arbitrary single bit unitary transformation.

Implements Qrack::QInterface.

◆ MultiShotMeasureMask() [1/2]

std::map< bitCapInt, int > Qrack::QUnitClifford::MultiShotMeasureMask ( const std::vector< bitCapInt > &  qPowers,
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[0U] 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::QUnitClifford::MultiShotMeasureMask ( const std::vector< bitCapInt > &  qPowers,
unsigned  shots,
unsigned long long *  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.

◆ NormalizeState()

void Qrack::QUnitClifford::NormalizeState ( real1_f  nrm = REAL1_DEFAULT_ARG,
real1_f  norm_thresh = REAL1_DEFAULT_ARG,
real1_f  phaseArg = ZERO_R1_F 
)
inlinevirtual

Apply the normalization factor found by UpdateRunningNorm() or on the fly by a single bit gate.

(On an actual quantum computer, the state should never require manual normalization.)

Warning
PSEUDO-QUANTUM

Implements Qrack::QInterface.

◆ OrderContiguous()

void Qrack::QUnitClifford::OrderContiguous ( QStabilizerPtr  unit)
protected

◆ PermCount()

bitCapInt Qrack::QUnitClifford::PermCount ( )
inline

◆ Phase()

void Qrack::QUnitClifford::Phase ( complex  topLeft,
complex  bottomRight,
bitLenInt  qubitIndex 
)
inlinevirtual

Apply a single bit transformation that only effects phase.

Reimplemented from Qrack::QInterface.

◆ Prob()

real1_f Qrack::QUnitClifford::Prob ( bitLenInt  qubitIndex)
inlinevirtual

Direct measure of bit probability to be in |1> state.

Warning
PSEUDO-QUANTUM

Implements Qrack::QInterface.

◆ ProbMask()

real1_f Qrack::QUnitClifford::ProbMask ( bitCapInt  mask,
bitCapInt  permutation 
)
virtual

Direct measure of masked permutation probability.

Returns probability of permutation of the mask.

"mask" masks the bits to check the probability of. "permutation" sets the 0 or 1 value for each bit in the mask. Bits which are set in the mask can be set to 0 or 1 in the permutation, while reset bits in the mask should be 0 in the permutation.

Warning
PSEUDO-QUANTUM

Reimplemented from Qrack::QInterface.

◆ ProbPermRdm()

real1_f Qrack::QUnitClifford::ProbPermRdm ( bitCapInt  perm,
bitLenInt  ancillaeStart 
)

◆ ResetPhaseOffset()

void Qrack::QUnitClifford::ResetPhaseOffset ( )
inline

◆ S()

void Qrack::QUnitClifford::S ( bitLenInt  t)
inlinevirtual

Apply a phase gate (|0>->|0>, |1>->i|1>, or "S") to qubit b.

Reimplemented from Qrack::QInterface.

◆ SeparateBit()

bool Qrack::QUnitClifford::SeparateBit ( bool  value,
bitLenInt  qubit 
)
protected

◆ SetAmplitude()

void Qrack::QUnitClifford::SetAmplitude ( bitCapInt  perm,
complex  amp 
)
inlinevirtual

Sets the representational amplitude of a full permutation.

Warning
PSEUDO-QUANTUM

Implements Qrack::QInterface.

◆ SetDevice()

void Qrack::QUnitClifford::SetDevice ( int64_t  dID)
inlinevirtual

Set the device index, if more than one device is available.

Implements Qrack::QInterface.

◆ SetPermutation()

void Qrack::QUnitClifford::SetPermutation ( bitCapInt  perm,
complex  phaseFac = CMPLX_DEFAULT_ARG 
)
virtual

Set to a specific permutation of all qubits.

Reimplemented from Qrack::QInterface.

◆ SetQuantumState()

void Qrack::QUnitClifford::SetQuantumState ( const complex inputState)
virtual

Set an arbitrary pure quantum state representation.

Warning
PSEUDO-QUANTUM

Implements Qrack::QInterface.

◆ SetRandGlobalPhase()

void Qrack::QUnitClifford::SetRandGlobalPhase ( bool  isRand)
inline

◆ SortUnit()

void Qrack::QUnitClifford::SortUnit ( QStabilizerPtr  unit,
std::vector< QSortEntry > &  bits,
bitLenInt  low,
bitLenInt  high 
)
protected

◆ SumSqrDiff() [1/2]

virtual real1_f Qrack::QUnitClifford::SumSqrDiff ( QInterfacePtr  toCompare)
inlinevirtual

Implements Qrack::QInterface.

◆ SumSqrDiff() [2/2]

real1_f Qrack::QUnitClifford::SumSqrDiff ( QUnitCliffordPtr  toCompare)
virtual

◆ Swap()

void Qrack::QUnitClifford::Swap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
inlinevirtual

Swap values of two bits in register.

Reimplemented from Qrack::QInterface.

◆ ThrowIfQubitInvalid()

void Qrack::QUnitClifford::ThrowIfQubitInvalid ( bitLenInt  t,
std::string  methodName 
)
inlineprotected

◆ ThrowIfQubitSetInvalid()

bitLenInt Qrack::QUnitClifford::ThrowIfQubitSetInvalid ( const std::vector< bitLenInt > &  controls,
bitLenInt  t,
std::string  methodName 
)
inlineprotected

◆ TrySeparate() [1/3]

bool Qrack::QUnitClifford::TrySeparate ( bitLenInt  qubit)
virtual

Single-qubit TrySeparate()

Reimplemented from Qrack::QInterface.

◆ TrySeparate() [2/3]

bool Qrack::QUnitClifford::TrySeparate ( bitLenInt  qubit1,
bitLenInt  qubit2 
)
inlinevirtual

Two-qubit TrySeparate()

Reimplemented from Qrack::QInterface.

◆ TrySeparate() [3/3]

bool Qrack::QUnitClifford::TrySeparate ( const std::vector< bitLenInt > &  qubits,
real1_f  error_tol 
)
inlinevirtual

Qrack::QUnit types maintain explicit separation of representations of qubits, which reduces memory usage and increases gate speed.

This method is used to manually attempt internal separation of a QUnit subsytem. We attempt a Decompose() operation, on a state which might not be separable. If the state is not separable, we abort and return false. Otherwise, we complete the operation, add the separated subsystem back in place into the QUnit "shards," and return true.

Warning
PSEUDO-QUANTUM

This should never change the logical/physical state of the QInterface, only possibly its internal representation, for simulation optimization purposes. This is not a truly quantum computational operation, but it also does not lead to nonphysical effects.

Reimplemented from Qrack::QInterface.

◆ UpdateRunningNorm()

void Qrack::QUnitClifford::UpdateRunningNorm ( real1_f  norm_thresh = REAL1_DEFAULT_ARG)
inlinevirtual

Force a calculation of the norm of the state vector, in order to make it unit length before the next probability or measurement operation.

(On an actual quantum computer, the state should never require manual normalization.)

Warning
PSEUDO-QUANTUM

Implements Qrack::QInterface.

◆ X() [1/3]

virtual void Qrack::QInterface::X
inline

Apply an X (or NOT) gate to target.

◆ X() [2/3]

virtual void Qrack::QInterface::X
inline

Apply an X (or NOT) gate to target.

◆ X() [3/3]

void Qrack::QUnitClifford::X ( bitLenInt  qubit)
inlinevirtual

X gate.

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

Reimplemented from Qrack::QInterface.

◆ Y()

void Qrack::QUnitClifford::Y ( bitLenInt  t)
inlinevirtual

Apply a Pauli Y gate to target.

Reimplemented from Qrack::QInterface.

◆ Z()

void Qrack::QUnitClifford::Z ( bitLenInt  t)
inlinevirtual

Apply a phase gate (|0>->|0>, |1>->-|1>, or "Z") to qubit b.

Reimplemented from Qrack::QInterface.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const QUnitCliffordPtr  s 
)
friend

◆ operator>>

std::istream& operator>> ( std::istream &  is,
const QUnitCliffordPtr  s 
)
friend

Member Data Documentation

◆ phaseOffset

complex Qrack::QUnitClifford::phaseOffset
protected

◆ shards

std::vector<CliffordShard> Qrack::QUnitClifford::shards
protected

The documentation for this class was generated from the following files: