Qrack  7.0
General classical-emulating-quantum development framework
Functions
Utility functions
Collaboration diagram for Utility functions:

Functions

virtual real1_f Qrack::QEngineCPU::Prob (bitLenInt qubitIndex)
 PSEUDO-QUANTUM Direct measure of bit probability to be in |1> state. More...
 
virtual real1_f Qrack::QEngineCPU::ProbReg (bitLenInt start, bitLenInt length, bitCapInt permutation)
 Direct measure of register permutation probability. More...
 
virtual real1_f Qrack::QEngineCPU::ProbMask (bitCapInt mask, bitCapInt permutation)
 Direct measure of masked permutation probability. More...
 
virtual real1_f Qrack::QEngineCPU::ProbParity (bitCapInt mask)
 Overall probability of any odd permutation of the masked set of bits. More...
 
virtual bool Qrack::QEngineCPU::ForceMParity (bitCapInt mask, bool result, bool doForce=true)
 Act as if is a measurement of parity of the masked set of qubits was applied, except force the (usually random) result. More...
 
virtual void Qrack::QEngineCPU::NormalizeState (real1_f nrm=REAL1_DEFAULT_ARG, real1_f norm_thresh=REAL1_DEFAULT_ARG, real1_f phaseArg=ZERO_R1)
 Apply the normalization factor found by UpdateRunningNorm() or on the fly by a single bit gate. More...
 
virtual real1_f Qrack::QEngineCPU::SumSqrDiff (QInterfacePtr toCompare)
 
virtual real1_f Qrack::QEngineCPU::SumSqrDiff (QEngineCPUPtr toCompare)
 
virtual QInterfacePtr Qrack::QEngineCPU::Clone ()
 Clone this QInterface. More...
 
virtual real1_f Qrack::QInterface::Prob (bitLenInt qubitIndex)=0
 Direct measure of bit probability to be in |1> state. More...
 
virtual real1_f Qrack::QInterface::ProbAll (bitCapInt fullRegister)
 Direct measure of full permutation probability. More...
 
virtual real1_f Qrack::QInterface::ProbReg (bitLenInt start, bitLenInt length, bitCapInt permutation)
 Direct measure of register permutation probability. More...
 
virtual real1_f Qrack::QInterface::ProbMask (bitCapInt mask, bitCapInt permutation)
 Direct measure of masked permutation probability. More...
 
virtual void Qrack::QInterface::ProbMaskAll (bitCapInt mask, real1 *probsArray)
 Direct measure of masked permutation probability. More...
 
virtual void Qrack::QInterface::ProbBitsAll (const bitLenInt *bits, bitLenInt length, real1 *probsArray)
 Direct measure of listed permutation probability. More...
 
virtual real1_f Qrack::QInterface::ExpectationBitsAll (const bitLenInt *bits, bitLenInt length, bitCapInt offset=0)
 Get permutation expectation value of bits. More...
 
virtual std::map< bitCapInt, int > Qrack::QInterface::MultiShotMeasureMask (const bitCapInt *qPowers, bitLenInt qPowerCount, unsigned shots)
 Statistical measure of masked permutation probability. More...
 
virtual void Qrack::QInterface::MultiShotMeasureMask (const bitCapInt *qPowers, bitLenInt qPowerCount, unsigned shots, unsigned *shotsArray)
 Statistical measure of masked permutation probability (returned as array) More...
 
virtual void Qrack::QInterface::SetBit (bitLenInt qubitIndex1, bool value)
 Set individual bit to pure |0> (false) or |1> (true) state. More...
 
virtual bool Qrack::QInterface::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...
 
virtual real1_f Qrack::QInterface::SumSqrDiff (QInterfacePtr toCompare)=0
 
virtual bool Qrack::QInterface::TryDecompose (bitLenInt start, QInterfacePtr dest, real1_f error_tol=TRYDECOMPOSE_EPSILON)
 
virtual void Qrack::QInterface::UpdateRunningNorm (real1_f norm_thresh=REAL1_DEFAULT_ARG)=0
 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 void Qrack::QInterface::NormalizeState (real1_f nrm=REAL1_DEFAULT_ARG, real1_f norm_thresh=REAL1_DEFAULT_ARG, real1_f phaseArg=ZERO_R1)=0
 Apply the normalization factor found by UpdateRunningNorm() or on the fly by a single bit gate. More...
 
virtual void Qrack::QInterface::Finish ()
 If asynchronous work is still running, block until it finishes. More...
 
virtual bool Qrack::QInterface::isFinished ()
 Returns "false" if asynchronous work is still running, and "true" if all previously dispatched asynchronous work is done. More...
 
virtual void Qrack::QInterface::Dump ()
 If asynchronous work is still running, let the simulator know that it can be aborted. More...
 
virtual bool Qrack::QInterface::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 Qrack::QInterface::isClifford ()
 Returns "true" if current state is identifiably within the Clifford set, or "false" if it is not or cannot be determined. More...
 
virtual bool Qrack::QInterface::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...
 
virtual bool Qrack::QInterface::TrySeparate (const bitLenInt *qubits, bitLenInt length, real1_f error_tol)
 Qrack::QUnit types maintain explicit separation of representations of qubits, which reduces memory usage and increases gate speed. More...
 
virtual bool Qrack::QInterface::TrySeparate (bitLenInt qubit)
 Single-qubit TrySeparate() More...
 
virtual bool Qrack::QInterface::TrySeparate (bitLenInt qubit1, bitLenInt qubit2)
 Two-qubit TrySeparate() More...
 
virtual void Qrack::QInterface::SetReactiveSeparate (bool isAggSep)
 Set reactive separation option (on by default if available) More...
 
virtual bool Qrack::QInterface::GetReactiveSeparate ()
 Get reactive separation option. More...
 
virtual QInterfacePtr Qrack::QInterface::Clone ()=0
 Clone this QInterface. More...
 
virtual void Qrack::QInterface::SetDevice (int dID, bool forceReInit=false)
 Set the device index, if more than one device is available. More...
 
virtual int64_t Qrack::QInterface::GetDevice ()
 Get the device index. More...
 
bitCapIntOcl Qrack::QInterface::GetMaxSize ()
 Get maximum number of amplitudes that can be allocated on current device. More...
 
virtual real1_f Qrack::QInterface::FirstNonzeroPhase ()
 Get phase of lowest permutation nonzero amplitude. More...
 
virtual real1_f Qrack::QUnit::Prob (bitLenInt qubit)
 Direct measure of bit probability to be in |1> state. More...
 
virtual real1_f Qrack::QUnit::ProbAll (bitCapInt fullRegister)
 Direct measure of full permutation probability. More...
 
virtual real1_f Qrack::QUnit::ProbParity (bitCapInt mask)
 Overall probability of any odd permutation of the masked set of bits. More...
 
virtual bool Qrack::QUnit::ForceMParity (bitCapInt mask, bool result, bool doForce=true)
 Act as if is a measurement of parity of the masked set of qubits was applied, except force the (usually random) result. More...
 
virtual real1_f Qrack::QUnit::SumSqrDiff (QInterfacePtr toCompare)
 
virtual real1_f Qrack::QUnit::ExpectationBitsAll (const bitLenInt *bits, bitLenInt length, bitCapInt offset=0)
 Get permutation expectation value of bits. More...
 
virtual real1_f Qrack::QUnit::SumSqrDiff (QUnitPtr toCompare)
 
virtual void Qrack::QUnit::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 void Qrack::QUnit::NormalizeState (real1_f nrm=REAL1_DEFAULT_ARG, real1_f norm_thresh=REAL1_DEFAULT_ARG, real1_f phaseArg=ZERO_R1)
 Apply the normalization factor found by UpdateRunningNorm() or on the fly by a single bit gate. More...
 
virtual void Qrack::QUnit::Finish ()
 If asynchronous work is still running, block until it finishes. More...
 
virtual bool Qrack::QUnit::isFinished ()
 Returns "false" if asynchronous work is still running, and "true" if all previously dispatched asynchronous work is done. More...
 
virtual void Qrack::QUnit::Dump ()
 If asynchronous work is still running, let the simulator know that it can be aborted. More...
 
virtual bool Qrack::QUnit::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...
 
virtual bool Qrack::QUnit::TrySeparate (const bitLenInt *qubits, bitLenInt length, real1_f error_tol)
 Qrack::QUnit types maintain explicit separation of representations of qubits, which reduces memory usage and increases gate speed. More...
 
virtual bool Qrack::QUnit::TrySeparate (bitLenInt qubit)
 Single-qubit TrySeparate() More...
 
virtual bool Qrack::QUnit::TrySeparate (bitLenInt qubit1, bitLenInt qubit2)
 Two-qubit TrySeparate() More...
 
virtual QInterfacePtr Qrack::QUnit::Clone ()
 Clone this QInterface. More...
 

Detailed Description

Function Documentation

◆ ApproxCompare()

virtual bool Qrack::QInterface::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 in Qrack::QStabilizerHybrid, and Qrack::QStabilizer.

◆ Clone() [1/3]

QInterfacePtr Qrack::QUnit::Clone ( )
virtual

Clone this QInterface.

Implements Qrack::QInterface.

Reimplemented in Qrack::QUnitMulti.

◆ Clone() [2/3]

QInterfacePtr Qrack::QEngineCPU::Clone ( )
virtual

Clone this QInterface.

Implements Qrack::QInterface.

◆ Clone() [3/3]

virtual QInterfacePtr Qrack::QInterface::Clone ( )
pure virtual

◆ Dump() [1/2]

virtual void Qrack::QUnit::Dump ( )
inlinevirtual

If asynchronous work is still running, let the simulator know that it can be aborted.

Note that this method is typically used internally where appropriate, such that user code typically does not call Dump().

Reimplemented from Qrack::QInterface.

◆ Dump() [2/2]

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

If asynchronous work is still running, let the simulator know that it can be aborted.

Note that this method is typically used internally where appropriate, such that user code typically does not call Dump().

Reimplemented in Qrack::QHybrid, Qrack::QPager, Qrack::QUnit, Qrack::QStabilizerHybrid, Qrack::QStabilizer, and Qrack::QEngineCPU.

◆ ExpectationBitsAll() [1/2]

real1_f Qrack::QUnit::ExpectationBitsAll ( const bitLenInt bits,
bitLenInt  length,
bitCapInt  offset = 0 
)
virtual

Get permutation expectation value of bits.

The permutation expectation value of all included bits is returned, with bits valued from low to high as the order of the "bits" array parameter argument.

Warning
PSEUDO-QUANTUM

Reimplemented from Qrack::QInterface.

◆ ExpectationBitsAll() [2/2]

real1_f Qrack::QInterface::ExpectationBitsAll ( const bitLenInt bits,
bitLenInt  length,
bitCapInt  offset = 0 
)
virtual

Get permutation expectation value of bits.

The permutation expectation value of all included bits is returned, with bits valued from low to high as the order of the "bits" array parameter argument.

Warning
PSEUDO-QUANTUM

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

◆ Finish() [1/2]

void Qrack::QUnit::Finish ( )
virtual

If asynchronous work is still running, block until it finishes.

Note that this is never necessary to get correct, timely return values. QEngines and other layers will always internally "Finish" when necessary for correct return values. This is primarily for debugging and benchmarking.

Reimplemented from Qrack::QInterface.

◆ Finish() [2/2]

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

If asynchronous work is still running, block until it finishes.

Note that this is never necessary to get correct, timely return values. QEngines and other layers will always internally "Finish" when necessary for correct return values. This is primarily for debugging and benchmarking.

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

◆ FirstNonzeroPhase()

virtual real1_f Qrack::QInterface::FirstNonzeroPhase ( )
inlinevirtual

Get phase of lowest permutation nonzero amplitude.

Reimplemented in Qrack::QStabilizer, Qrack::QEngineOCL, and Qrack::QEngineCPU.

◆ ForceMParity() [1/2]

bool Qrack::QUnit::ForceMParity ( bitCapInt  mask,
bool  result,
bool  doForce = true 
)
virtual

Act as if is a measurement of parity of the masked set of qubits was applied, except force the (usually random) result.

Warning
PSEUDO-QUANTUM

Implements Qrack::QParity.

◆ ForceMParity() [2/2]

bool Qrack::QEngineCPU::ForceMParity ( bitCapInt  mask,
bool  result,
bool  doForce = true 
)
virtual

Act as if is a measurement of parity of the masked set of qubits was applied, except force the (usually random) result.

Warning
PSEUDO-QUANTUM

Implements Qrack::QParity.

◆ GetDevice()

virtual int64_t Qrack::QInterface::GetDevice ( )
inlinevirtual

Get the device index.

("-1" is default).

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

◆ GetMaxSize()

bitCapIntOcl Qrack::QInterface::GetMaxSize ( )
inline

Get maximum number of amplitudes that can be allocated on current device.

◆ GetReactiveSeparate()

virtual bool Qrack::QInterface::GetReactiveSeparate ( )
inlinevirtual

Get reactive separation option.

If reactive separation is available, as in Qrack::QUnit, then turning this option on attempts to more-aggresively recover separability of subsystems. It can either hurt or help performance, though it commonly helps.

Reimplemented in Qrack::QUnit.

◆ isBinaryDecisionTree()

virtual bool Qrack::QInterface::isBinaryDecisionTree ( )
inlinevirtual

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.

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

◆ isClifford() [1/3]

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

◆ isClifford() [2/3]

virtual bool Qrack::QInterface::isClifford ( )
inlinevirtual

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

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

◆ isClifford() [3/3]

virtual bool Qrack::QInterface::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 in Qrack::QStabilizerHybrid, Qrack::QUnit, and Qrack::QStabilizer.

◆ isFinished() [1/2]

bool Qrack::QUnit::isFinished ( )
virtual

Returns "false" if asynchronous work is still running, and "true" if all previously dispatched asynchronous work is done.

Reimplemented from Qrack::QInterface.

◆ isFinished() [2/2]

virtual bool Qrack::QInterface::isFinished ( )
inlinevirtual

Returns "false" if asynchronous work is still running, and "true" if all previously dispatched asynchronous work is done.

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

◆ MultiShotMeasureMask() [1/2]

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

Statistical measure of masked permutation probability.

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

Warning
PSEUDO-QUANTUM

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

◆ MultiShotMeasureMask() [2/2]

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

Statistical measure of masked permutation probability (returned as array)

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

Warning
PSEUDO-QUANTUM

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

◆ NormalizeState() [1/3]

void Qrack::QUnit::NormalizeState ( real1_f  nrm = REAL1_DEFAULT_ARG,
real1_f  norm_thresh = REAL1_DEFAULT_ARG,
real1_f  phaseArg = ZERO_R1 
)
virtual

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.

◆ NormalizeState() [2/3]

void Qrack::QEngineCPU::NormalizeState ( real1_f  nrm = REAL1_DEFAULT_ARG,
real1_f  norm_thresh = REAL1_DEFAULT_ARG,
real1_f  phaseArg = ZERO_R1 
)
virtual

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.

◆ NormalizeState() [3/3]

virtual void Qrack::QInterface::NormalizeState ( real1_f  nrm = REAL1_DEFAULT_ARG,
real1_f  norm_thresh = REAL1_DEFAULT_ARG,
real1_f  phaseArg = ZERO_R1 
)
pure virtual

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

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

◆ Prob() [1/3]

real1_f Qrack::QUnit::Prob ( bitLenInt  qubitIndex)
virtual

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

Warning
PSEUDO-QUANTUM

Implements Qrack::QInterface.

◆ Prob() [2/3]

real1_f Qrack::QEngineCPU::Prob ( bitLenInt  qubitIndex)
virtual

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

Implements Qrack::QInterface.

◆ Prob() [3/3]

virtual real1_f Qrack::QInterface::Prob ( bitLenInt  qubitIndex)
pure virtual

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

Warning
PSEUDO-QUANTUM

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

◆ ProbAll() [1/2]

real1_f Qrack::QUnit::ProbAll ( bitCapInt  fullRegister)
virtual

Direct measure of full permutation probability.

Warning
PSEUDO-QUANTUM

Reimplemented from Qrack::QInterface.

◆ ProbAll() [2/2]

virtual real1_f Qrack::QInterface::ProbAll ( bitCapInt  fullRegister)
inlinevirtual

Direct measure of full permutation probability.

Warning
PSEUDO-QUANTUM

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

◆ ProbBitsAll()

void Qrack::QInterface::ProbBitsAll ( const bitLenInt bits,
bitLenInt  length,
real1 probsArray 
)
virtual

Direct measure of listed permutation probability.

The probabilities of all included permutations of bits, with bits valued from low to high as the order of the "bits" array parameter argument, are returned in the "probsArray" parameter.

Warning
PSEUDO-QUANTUM

◆ ProbMask() [1/2]

real1_f Qrack::QEngineCPU::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

Implements Qrack::QEngine.

◆ ProbMask() [2/2]

real1_f Qrack::QInterface::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 in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, Qrack::QEngineOCL, Qrack::QHybrid, Qrack::QEngineCPU, Qrack::QPager, and Qrack::QEngine.

◆ ProbMaskAll()

void Qrack::QInterface::ProbMaskAll ( bitCapInt  mask,
real1 probsArray 
)
virtual

Direct measure of masked permutation probability.

"mask" masks the bits to check the probability of. The probabilities of all permutations of the masked bits, from left/low to right/high are returned in the "probsArray" argument.

Warning
PSEUDO-QUANTUM

Reimplemented in Qrack::QEngineOCL.

◆ ProbParity() [1/2]

real1_f Qrack::QUnit::ProbParity ( bitCapInt  mask)
virtual

Overall probability of any odd permutation of the masked set of bits.

Implements Qrack::QParity.

◆ ProbParity() [2/2]

real1_f Qrack::QEngineCPU::ProbParity ( bitCapInt  mask)
virtual

Overall probability of any odd permutation of the masked set of bits.

Implements Qrack::QParity.

◆ ProbReg() [1/2]

real1_f Qrack::QEngineCPU::ProbReg ( bitLenInt  start,
bitLenInt  length,
bitCapInt  permutation 
)
virtual

Direct measure of register permutation probability.

Returns probability of permutation of the register.

Warning
PSEUDO-QUANTUM

Implements Qrack::QEngine.

◆ ProbReg() [2/2]

real1_f Qrack::QInterface::ProbReg ( bitLenInt  start,
bitLenInt  length,
bitCapInt  permutation 
)
virtual

Direct measure of register permutation probability.

Returns probability of permutation of the register.

Warning
PSEUDO-QUANTUM

Reimplemented in Qrack::QEngineOCL, Qrack::QEngineCPU, Qrack::QMaskFusion, Qrack::QEngine, and Qrack::QHybrid.

◆ SetBit()

void Qrack::QInterface::SetBit ( bitLenInt  qubitIndex1,
bool  value 
)
virtual

Set individual bit to pure |0> (false) or |1> (true) state.

To set a bit, the bit is first measured. If the result of measurement matches "value," the bit is considered set. If the result of measurement is the opposite of "value," an X gate is applied to the bit. The state ends up entirely in the "value" state, with a random phase factor.

◆ SetDevice()

virtual void Qrack::QInterface::SetDevice ( int  dID,
bool  forceReInit = false 
)
inlinevirtual

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

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

◆ SetReactiveSeparate()

virtual void Qrack::QInterface::SetReactiveSeparate ( bool  isAggSep)
inlinevirtual

Set reactive separation option (on by default if available)

If reactive separation is available, as in Qrack::QUnit, then turning this option on attempts to more-aggresively recover separability of subsystems. It can either hurt or help performance, though it commonly helps.

Reimplemented in Qrack::QUnit.

◆ SumSqrDiff() [1/5]

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

Implements Qrack::QInterface.

◆ SumSqrDiff() [2/5]

real1_f Qrack::QUnit::SumSqrDiff ( QUnitPtr  toCompare)
virtual

◆ SumSqrDiff() [3/5]

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

Implements Qrack::QInterface.

◆ SumSqrDiff() [4/5]

real1_f Qrack::QEngineCPU::SumSqrDiff ( QEngineCPUPtr  toCompare)
virtual

◆ SumSqrDiff() [5/5]

virtual real1_f Qrack::QInterface::SumSqrDiff ( QInterfacePtr  toCompare)
pure virtual

◆ TryDecompose()

bool Qrack::QInterface::TryDecompose ( bitLenInt  start,
QInterfacePtr  dest,
real1_f  error_tol = TRYDECOMPOSE_EPSILON 
)
virtual

◆ TrySeparate() [1/6]

bool Qrack::QUnit::TrySeparate ( const bitLenInt qubits,
bitLenInt  length,
real1_f  error_tol 
)
virtual

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.

◆ TrySeparate() [2/6]

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

Single-qubit TrySeparate()

Reimplemented from Qrack::QInterface.

◆ TrySeparate() [3/6]

bool Qrack::QUnit::TrySeparate ( bitLenInt  qubit1,
bitLenInt  qubit2 
)
virtual

Two-qubit TrySeparate()

Reimplemented from Qrack::QInterface.

◆ TrySeparate() [4/6]

virtual bool Qrack::QInterface::TrySeparate ( const bitLenInt qubits,
bitLenInt  length,
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 in Qrack::QStabilizerHybrid, Qrack::QMaskFusion, and Qrack::QUnit.

◆ TrySeparate() [5/6]

virtual bool Qrack::QInterface::TrySeparate ( bitLenInt  qubit)
inlinevirtual

◆ TrySeparate() [6/6]

virtual bool Qrack::QInterface::TrySeparate ( bitLenInt  qubit1,
bitLenInt  qubit2 
)
inlinevirtual

◆ UpdateRunningNorm() [1/2]

void Qrack::QUnit::UpdateRunningNorm ( real1_f  norm_thresh = REAL1_DEFAULT_ARG)
virtual

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.

◆ UpdateRunningNorm() [2/2]

virtual void Qrack::QInterface::UpdateRunningNorm ( real1_f  norm_thresh = REAL1_DEFAULT_ARG)
pure virtual

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

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