QEngine

Defined in qengine.hpp.

This is an (abstract) intermediate specialization that inherits from Qrack::QInterface. This type is specifically a “state vector” simulation, with corresponding special methods.

Qrack::QEngine::QEngine(bitLenInt qBitCount, qrack_rand_gen_ptr rgp = nullptr, bool doNorm = false, bool randomGlobalPhase = true, bool useHostMem = false, bool useHardwareRNG = true, real1_f norm_thresh = REAL1_EPSILON)
Qrack::QEngine::QEngine()

Default constructor, primarily for protected internal use.

virtual void Qrack::QEngine::ZeroAmplitudes() = 0

Set all amplitudes to 0, and optionally temporarily deallocate state vector RAM.

virtual void Qrack::QEngine::CopyStateVec(QEnginePtr src) = 0

Exactly copy the state vector of a different QEngine instance.

virtual bool Qrack::QEngine::IsZeroAmplitude() = 0

Returns “true” only if amplitudes are all totally 0.

virtual void Qrack::QEngine::GetAmplitudePage(complex *pagePtr, bitCapIntOcl offset, bitCapIntOcl length) = 0

Copy a “page” of amplitudes from this QEngine’s internal state, into pagePtr.

Warning

doxygenfunction: Unable to resolve multiple matches for function “Qrack::QEngine::SetAmplitudePage” with arguments (const complex *, const bitCapIntOcl, const bitCapIntOcl) in doxygen xml output for project “qrack” from directory: /tmp/qrack/doc/xml. Potential matches:

- virtual void Qrack::QEngine::SetAmplitudePage(QEnginePtr, bitCapIntOcl, bitCapIntOcl, bitCapIntOcl) = 0
- virtual void Qrack::QEngine::SetAmplitudePage(const complex *, bitCapIntOcl, bitCapIntOcl) = 0

Warning

doxygenfunction: Unable to resolve multiple matches for function “Qrack::QEngine::SetAmplitudePage” with arguments (QEnginePtr, const bitCapIntOcl, const bitCapIntOcl, const bitCapIntOcl) in doxygen xml output for project “qrack” from directory: /tmp/qrack/doc/xml. Potential matches:

- virtual void Qrack::QEngine::SetAmplitudePage(QEnginePtr, bitCapIntOcl, bitCapIntOcl, bitCapIntOcl) = 0
- virtual void Qrack::QEngine::SetAmplitudePage(const complex *, bitCapIntOcl, bitCapIntOcl) = 0
virtual void Qrack::QEngine::ShuffleBuffers(QEnginePtr engine) = 0

Swap the high half of this engine with the low half of another.

This is necessary for gates which cross sub-engine boundaries.

virtual void Qrack::QEngine::QueueSetDoNormalize(bool doNorm) = 0

Add an operation to the (OpenCL) queue, to set the value of doNormalize, which controls whether to automatically normalize the state.

virtual void Qrack::QEngine::QueueSetRunningNorm(real1_f runningNrm) = 0

Add an operation to the (OpenCL) queue, to set the value of runningNorm, which is the normalization constant for the next normalization operation.