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

Functions

virtual void Qrack::QEngineCPU::SetPermutation (bitCapInt perm, complex phaseFac=CMPLX_DEFAULT_ARG)
 Set to a specific permutation of all qubits. More...
 
virtual void Qrack::QEngineCPU::UniformlyControlledSingleBit (const bitLenInt *controls, bitLenInt controlLen, bitLenInt qubitIndex, const complex *mtrxs, const bitCapInt *mtrxSkipPowers, bitLenInt mtrxSkipLen, bitCapInt mtrxSkipValueMask)
 
virtual 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...
 
virtual void Qrack::QEngineCPU::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::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 bitLenInt *qubits, bitLenInt length, 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 bitLenInt *qubits, bitLenInt length, 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 bitLenInt *bits, bitLenInt length)
 Measure bits with indices in array, and return a mask of the results. More...
 
virtual bitCapInt Qrack::QInterface::ForceM (const bitLenInt *bits, bitLenInt length, const 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::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::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 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.

◆ ForceM()

bitCapInt Qrack::QInterface::ForceM ( const bitLenInt bits,
bitLenInt  length,
const 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, 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::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QHybrid, Qrack::QStabilizer, Qrack::QPager, Qrack::QBdt, Qrack::QUnit, and Qrack::QEngine.

◆ 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 bitLenInt qubits,
bitLenInt  length,
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::QMaskFusion, Qrack::QHybrid, Qrack::QPager, Qrack::QUnit, and Qrack::QEngine.

◆ ISwap() [1/2]

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

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

◆ M()

virtual bitCapInt Qrack::QInterface::M ( const bitLenInt bits,
bitLenInt  length 
)
inlinevirtual

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

◆ MAll()

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

Measure permutation state of all coherent bits.

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

◆ MReg()

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

Measure permutation state of a register.

◆ PhaseFlip()

void Qrack::QInterface::PhaseFlip ( )
virtual

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 bitLenInt qubits,
bitLenInt  length,
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::QUnit::SetReg ( bitLenInt  start,
bitLenInt  length,
bitCapInt  value 
)
virtual

Set register bits to given permutation.

Reimplemented from Qrack::QInterface.

◆ SetReg() [2/2]

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

Set register bits to given permutation.

Reimplemented in Qrack::QUnit.

◆ 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]

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

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 bitLenInt controls,
bitLenInt  controlLen,
bitLenInt  qubitIndex,
const complex mtrxs,
const bitCapInt mtrxSkipPowers,
bitLenInt  mtrxSkipLen,
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.