Qrack  9.0
General classical-emulating-quantum development framework
Functions
Extra operations and capabilities
Collaboration diagram for Extra operations and capabilities:

Functions

void Qrack::QEngineCPU::SetPermutation (bitCapInt perm, complex phaseFac=CMPLX_DEFAULT_ARG)
 Set to a specific permutation of all qubits. More...
 
void Qrack::QEngineCPU::UniformlyControlledSingleBit (const std::vector< bitLenInt > &controls, bitLenInt qubitIndex, const complex *mtrxs, const std::vector< bitCapInt > &mtrxSkipPowers, bitCapInt mtrxSkipValueMask)
 
void Qrack::QEngineCPU::UniformParityRZ (bitCapInt mask, real1_f angle)
 If the target qubit set parity is odd, this applies a phase factor of \(e^{i angle}\). More...
 
void Qrack::QEngineCPU::CUniformParityRZ (const std::vector< bitLenInt > &controls, 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::QInterface::QFT (bitLenInt start, bitLenInt length, bool trySeparate=false)
 Quantum Fourier Transform - Apply the quantum Fourier transform to the register. More...
 
virtual void Qrack::QInterface::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 Qrack::QInterface::IQFT (bitLenInt start, bitLenInt length, bool trySeparate=false)
 Inverse Quantum Fourier Transform - Apply the inverse quantum Fourier transform to the register. More...
 
virtual void Qrack::QInterface::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 Qrack::QInterface::ZeroPhaseFlip (bitLenInt start, bitLenInt length)
 Reverse the phase of the state where the register equals zero. More...
 
virtual void Qrack::QInterface::PhaseFlip ()
 Phase flip always - equivalent to Z X Z X on any bit in the QInterface. More...
 
virtual void Qrack::QInterface::SetReg (bitLenInt start, bitLenInt length, bitCapInt value)
 Set register bits to given permutation. More...
 
virtual bitCapInt Qrack::QInterface::MReg (bitLenInt start, bitLenInt length)
 Measure permutation state of a register. More...
 
virtual bitCapInt Qrack::QInterface::MAll ()
 Measure permutation state of all coherent bits. More...
 
virtual bitCapInt Qrack::QInterface::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::QInterface::M (const std::vector< bitLenInt > &bits)
 Measure bits with indices in array, and return a mask of the results. More...
 
virtual bitCapInt Qrack::QInterface::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 Qrack::QInterface::Swap (bitLenInt qubitIndex1, bitLenInt qubitIndex2)
 Swap values of two bits in register. More...
 
virtual void Qrack::QInterface::ISwap (bitLenInt qubitIndex1, bitLenInt qubitIndex2)
 Swap values of two bits in register, and apply phase factor of i if bits are different. More...
 
virtual void Qrack::QInterface::IISwap (bitLenInt qubitIndex1, bitLenInt qubitIndex2)
 Inverse ISwap - Swap values of two bits in register, and apply phase factor of -i if bits are different. More...
 
virtual void Qrack::QInterface::SqrtSwap (bitLenInt qubitIndex1, bitLenInt qubitIndex2)
 Square root of Swap gate. More...
 
virtual void Qrack::QInterface::ISqrtSwap (bitLenInt qubitIndex1, bitLenInt qubitIndex2)
 Inverse square root of Swap gate. More...
 
virtual void Qrack::QInterface::FSim (real1_f theta, real1_f phi, bitLenInt qubitIndex1, bitLenInt qubitIndex2)=0
 The 2-qubit "fSim" gate, (useful in the simulation of particles with fermionic statistics) More...
 
virtual void Qrack::QInterface::Reverse (bitLenInt first, bitLenInt last)
 Reverse all of the bits in a sequence. More...
 
virtual void Qrack::QUnit::SetReg (bitLenInt start, bitLenInt length, bitCapInt value)
 Set register bits to given permutation. More...
 
virtual void Qrack::QUnit::Swap (bitLenInt qubit1, bitLenInt qubit2)
 Swap values of two bits in register. More...
 
virtual void Qrack::QUnit::ISwap (bitLenInt qubit1, bitLenInt qubit2)
 Swap values of two bits in register, and apply phase factor of i if bits are different. More...
 
virtual void Qrack::QUnit::IISwap (bitLenInt qubit1, bitLenInt qubit2)
 Inverse ISwap - Swap values of two bits in register, and apply phase factor of -i if bits are different. More...
 
virtual void Qrack::QUnit::SqrtSwap (bitLenInt qubit1, bitLenInt qubit2)
 Square root of Swap gate. More...
 
virtual void Qrack::QUnit::ISqrtSwap (bitLenInt qubit1, bitLenInt qubit2)
 Inverse square root of Swap gate. More...
 
virtual void Qrack::QUnit::FSim (real1_f theta, real1_f phi, bitLenInt qubit1, bitLenInt qubit2)
 The 2-qubit "fSim" gate, (useful in the simulation of particles with fermionic statistics) More...
 

Detailed Description

Function Documentation

◆ CUniformParityRZ()

void Qrack::QEngineCPU::CUniformParityRZ ( const std::vector< bitLenInt > &  controls,
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.

◆ ForceM()

bitCapInt Qrack::QInterface::ForceM ( const std::vector< bitLenInt > &  bits,
const std::vector< bool > &  values,
bool  doApply = true 
)
virtual

Measure bits with indices in array, and return a mask of the results.

Bit-wise apply measurement gate to a register.

Reimplemented in Qrack::QEngine.

◆ ForceMReg()

bitCapInt Qrack::QInterface::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 in Qrack::QUnit, Qrack::QPager, and Qrack::QEngine.

◆ FSim() [1/2]

void Qrack::QUnit::FSim ( real1_f  theta,
real1_f  phi,
bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
virtual

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

Implements Qrack::QInterface.

◆ FSim() [2/2]

virtual void Qrack::QInterface::FSim ( real1_f  theta,
real1_f  phi,
bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
pure virtual

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

Implemented in Qrack::QPager, Qrack::QHybrid, Qrack::QEngine, Qrack::QBdtHybrid, Qrack::QBdt, Qrack::QUnit, Qrack::QTensorNetwork, Qrack::QStabilizerHybrid, Qrack::QStabilizer, and Qrack::QUnitClifford.

◆ IISwap() [1/2]

virtual void Qrack::QUnit::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.

◆ IISwap() [2/2]

void Qrack::QInterface::IISwap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
virtual

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

Reimplemented in Qrack::QStabilizer, Qrack::QHybrid, Qrack::QBdtHybrid, Qrack::QUnit, Qrack::QStabilizerHybrid, Qrack::QPager, Qrack::QEngine, Qrack::QBdt, and Qrack::QUnitClifford.

◆ IQFT()

void Qrack::QInterface::IQFT ( bitLenInt  start,
bitLenInt  length,
bool  trySeparate = false 
)
virtual

Inverse Quantum Fourier Transform - Apply the inverse quantum Fourier transform to the register.

Inverse Quantum Fourier Transform - Quantum Fourier transform optimized for going from |+>/|-> to |0>/|1> basis.

"trySeparate" is an optional hit-or-miss optimization, specifically for QUnit types. Our suggestion is, turn it on for speed and memory effciency if you expect the result of the QFT to be in a permutation basis eigenstate. Otherwise, turning it on will probably take longer.

◆ IQFTR()

void Qrack::QInterface::IQFTR ( const std::vector< bitLenInt > &  qubits,
bool  trySeparate = false 
)
virtual

Inverse Quantum Fourier Transform (random access) - Apply the inverse quantum Fourier transform to the register.

Inverse Quantum Fourier Transform - Quantum Fourier transform optimized for going from |+>/|-> to |0>/|1> basis.

"trySeparate" is an optional hit-or-miss optimization, specifically for QUnit types. Our suggestion is, turn it on for speed and memory effciency if you expect the result of the QFT to be in a permutation basis eigenstate. Otherwise, turning it on will probably take longer.

◆ ISqrtSwap() [1/2]

void Qrack::QUnit::ISqrtSwap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
virtual

Inverse square root of Swap gate.

Reimplemented from Qrack::QInterface.

◆ ISqrtSwap() [2/2]

void Qrack::QInterface::ISqrtSwap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
virtual

Inverse square root of Swap gate.

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

◆ ISwap() [1/2]

virtual void Qrack::QUnit::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.

◆ ISwap() [2/2]

void Qrack::QInterface::ISwap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
virtual

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

Reimplemented in Qrack::QStabilizer, Qrack::QHybrid, Qrack::QBdtHybrid, Qrack::QUnit, Qrack::QStabilizerHybrid, Qrack::QPager, Qrack::QEngine, Qrack::QBdt, and Qrack::QUnitClifford.

◆ M()

virtual bitCapInt Qrack::QInterface::M ( const std::vector< bitLenInt > &  bits)
inlinevirtual

Measure bits with indices in array, and return a mask of the results.

◆ MAll()

virtual bitCapInt Qrack::QInterface::MAll ( )
inlinevirtual

◆ MReg()

virtual bitCapInt Qrack::QInterface::MReg ( bitLenInt  start,
bitLenInt  length 
)
inlinevirtual

Measure permutation state of a register.

◆ PhaseFlip()

virtual void Qrack::QInterface::PhaseFlip ( )
inlinevirtual

Phase flip always - equivalent to Z X Z X on any bit in the QInterface.

Reimplemented in Qrack::QStabilizerHybrid.

◆ QFT()

void Qrack::QInterface::QFT ( bitLenInt  start,
bitLenInt  length,
bool  trySeparate = false 
)
virtual

Quantum Fourier Transform - Apply the quantum Fourier transform to the register.

Quantum Fourier Transform - Optimized for going from |0>/|1> to |+>/|-> basis.

"trySeparate" is an optional hit-or-miss optimization, specifically for QUnit types. Our suggestion is, turn it on for speed and memory effciency if you expect the result of the QFT to be in a permutation basis eigenstate. Otherwise, turning it on will probably take longer.

◆ QFTR()

void Qrack::QInterface::QFTR ( const std::vector< bitLenInt > &  qubits,
bool  trySeparate = false 
)
virtual

Quantum Fourier Transform (random access) - Apply the quantum Fourier transform to the register.

Quantum Fourier Transform - Optimized for going from |0>/|1> to |+>/|-> basis.

"trySeparate" is an optional hit-or-miss optimization, specifically for QUnit types. Our suggestion is, turn it on for speed and memory effciency if you expect the result of the QFT to be in a permutation basis eigenstate. Otherwise, turning it on will probably take longer.

◆ Reverse()

virtual void Qrack::QInterface::Reverse ( bitLenInt  first,
bitLenInt  last 
)
inlinevirtual

Reverse all of the bits in a sequence.

◆ SetPermutation()

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

Set to a specific permutation of all qubits.

Reimplemented from Qrack::QInterface.

◆ SetReg() [1/2]

void Qrack::QInterface::SetReg ( bitLenInt  start,
bitLenInt  length,
bitCapInt  value 
)
virtual

Set register bits to given permutation.

Reimplemented in Qrack::QUnit.

◆ SetReg() [2/2]

void Qrack::QUnit::SetReg ( bitLenInt  start,
bitLenInt  length,
bitCapInt  value 
)
virtual

Set register bits to given permutation.

Reimplemented from Qrack::QInterface.

◆ SqrtSwap() [1/2]

void Qrack::QUnit::SqrtSwap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
virtual

Square root of Swap gate.

Reimplemented from Qrack::QInterface.

◆ SqrtSwap() [2/2]

void Qrack::QInterface::SqrtSwap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
virtual

◆ Swap() [1/2]

virtual void Qrack::QUnit::Swap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
inlinevirtual

Swap values of two bits in register.

Reimplemented from Qrack::QInterface.

◆ Swap() [2/2]

void Qrack::QInterface::Swap ( bitLenInt  qubitIndex1,
bitLenInt  qubitIndex2 
)
virtual

◆ UniformlyControlledSingleBit()

void Qrack::QEngineCPU::UniformlyControlledSingleBit ( const std::vector< bitLenInt > &  controls,
bitLenInt  qubitIndex,
const complex mtrxs,
const std::vector< bitCapInt > &  mtrxSkipPowers,
bitCapInt  mtrxSkipValueMask 
)
virtual

Reimplemented from Qrack::QInterface.

◆ UniformParityRZ()

void Qrack::QEngineCPU::UniformParityRZ ( bitCapInt  mask,
real1_f  angle 
)
virtual

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

If the target qubit set parity is even, this applies the conjugate, e^{-i angle}.

Reimplemented from Qrack::QParity.

◆ ZeroPhaseFlip()

void Qrack::QInterface::ZeroPhaseFlip ( bitLenInt  start,
bitLenInt  length 
)
virtual

Reverse the phase of the state where the register equals zero.

Reimplemented in Qrack::QStabilizerHybrid.