Qrack  7.0
General classical-emulating-quantum development framework
Classes | Typedefs | Enumerations | Functions | Variables
Qrack Namespace Reference

Classes

struct  AmplitudeEntry
 
struct  Complex16x2Simd
 SIMD implementation of the double precision complex vector type of 2 complex numbers, only for AVX Apply2x2. More...
 
union  complex2
 
struct  Complex8x2Simd
 SIMD implementation of the float precision complex vector type of 2 complex numbers, only for COMPLEX_X_2 Apply2x2. More...
 
struct  DeviceInfo
 
class  DispatchQueue
 
struct  HamiltonianOp
 A Hamiltonian can be specified in terms of arbitrary controlled single bit gates, each one an "HamiltonianOp.". More...
 
struct  InitOClResult
 
struct  MpsShard
 
class  OCLDeviceCall
 
class  OCLDeviceContext
 
class  OCLEngine
 "Qrack::OCLEngine" manages the single OpenCL context. More...
 
struct  OCLKernelHandle
 
class  ParallelFor
 
struct  PhaseShard
 Caches controlled gate phase between shards, (as a case of "gate fusion" optimization particularly useful to QUnit) More...
 
struct  PoolItem
 
class  QAlu
 
class  QBdt
 
class  QBdtNode
 
class  QBdtNodeInterface
 
class  QBdtQInterfaceNode
 
class  QEngine
 Abstract QEngine implementation, for all "Schroedinger method" engines. More...
 
class  QEngineCPU
 General purpose QEngineCPU implementation. More...
 
struct  QEngineInfo
 
class  QEngineOCL
 OpenCL enhanced QEngineCPU implementation. More...
 
class  QEngineShard
 Associates a QInterface object with a set of bits. More...
 
class  QEngineShardMap
 
class  QHybrid
 A "Qrack::QHybrid" internally switched between Qrack::QEngineCPU and Qrack::QEngineOCL to maximize qubit-count-dependent performance. More...
 
class  QInterface
 A "Qrack::QInterface" is an abstract interface exposing qubit permutation state vector with methods to operate on it as by gates and register-like instructions. More...
 
class  QMaskFusion
 A "Qrack::QMaskFusion" internally switched between Qrack::QEngineCPU and Qrack::QEngineOCL to maximize qubit-count-dependent performance. More...
 
struct  QMaskFusionShard
 
class  QNeuron
 
class  QPager
 A "Qrack::QPager" splits a "Qrack::QEngine" implementation into equal-length "pages." This helps both optimization and distribution of a single coherent quantum register across multiple devices. More...
 
class  QParity
 
class  QStabilizer
 
class  QStabilizerHybrid
 A "Qrack::QStabilizerHybrid" internally switched between Qrack::QEngineCPU and Qrack::QEngineOCL to maximize qubit-count-dependent performance. More...
 
class  QubitSwapMap
 
struct  QueueItem
 
class  QUnit
 
class  QUnitMulti
 
class  RdRandom
 
class  StateVector
 
class  StateVectorArray
 
class  StateVectorSparse
 
struct  UniformHamiltonianOp
 

Typedefs

typedef std::shared_ptr< OCLDeviceContextDeviceContextPtr
 
typedef std::shared_ptr< std::vector< cl::Event > > EventVecPtr
 
typedef std::complex< half_float::halfcomplex
 
typedef half_float::half real1
 
typedef float real1_f
 
typedef std::shared_ptr< complexBitOp
 
typedef std::function< void(const bitCapIntOcl &, const unsigned &cpu)> ParallelFunc
 Called once per value between begin and end. More...
 
typedef std::function< bitCapIntOcl(const bitCapIntOcl &, const unsigned &cpu)> IncrementFunc
 
typedef std::function< bitCapInt(const bitCapInt &, const unsigned &cpu)> BdtFunc
 
typedef std::shared_ptr< StateVectorStateVectorPtr
 
typedef std::shared_ptr< StateVectorArrayStateVectorArrayPtr
 
typedef std::shared_ptr< StateVectorSparseStateVectorSparsePtr
 
typedef std::shared_ptr< QEngineQEnginePtr
 
typedef std::shared_ptr< HamiltonianOpHamiltonianOpPtr
 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...
 
typedef std::vector< HamiltonianOpPtrHamiltonian
 
typedef std::shared_ptr< MpsShardMpsShardPtr
 
typedef std::shared_ptr< QAluQAluPtr
 
typedef std::shared_ptr< QBdtQBdtPtr
 
typedef std::shared_ptr< QBdtNodeQBdtNodePtr
 
typedef std::shared_ptr< QBdtNodeInterfaceQBdtNodeInterfacePtr
 
typedef std::shared_ptr< QBdtQInterfaceNodeQBdtQInterfaceNodePtr
 
typedef std::shared_ptr< QBdtQEngineNode > QBdtQEngineNodePtr
 
typedef std::shared_ptr< QEngineCPUQEngineCPUPtr
 
typedef std::shared_ptr< cl::Buffer > BufferPtr
 
typedef std::shared_ptr< QEngineOCLQEngineOCLPtr
 
typedef std::shared_ptr< PoolItemPoolItemPtr
 
typedef QEngineShardQEngineShardPtr
 
typedef std::shared_ptr< PhaseShardPhaseShardPtr
 
typedef std::map< QEngineShardPtr, PhaseShardPtrShardToPhaseMap
 
typedef std::shared_ptr< QHybridQHybridPtr
 
typedef std::shared_ptr< QInterfaceQInterfacePtr
 
typedef std::shared_ptr< QMaskFusionQMaskFusionPtr
 
typedef std::shared_ptr< QNeuronQNeuronPtr
 
typedef std::shared_ptr< QPagerQPagerPtr
 
typedef std::shared_ptr< QParityQParityPtr
 
typedef std::shared_ptr< QStabilizerQStabilizerPtr
 
typedef std::shared_ptr< QStabilizerHybridQStabilizerHybridPtr
 
typedef std::shared_ptr< QUnitQUnitPtr
 
typedef std::shared_ptr< QUnitMultiQUnitMultiPtr
 

Enumerations

enum  OCLAPI {
  OCL_API_UNKNOWN = 0, OCL_API_APPLY2X2, OCL_API_APPLY2X2_SINGLE, OCL_API_APPLY2X2_NORM_SINGLE,
  OCL_API_APPLY2X2_DOUBLE, OCL_API_APPLY2X2_WIDE, OCL_API_APPLY2X2_SINGLE_WIDE, OCL_API_APPLY2X2_NORM_SINGLE_WIDE,
  OCL_API_APPLY2X2_DOUBLE_WIDE, OCL_API_PHASE_SINGLE, OCL_API_PHASE_SINGLE_WIDE, OCL_API_INVERT_SINGLE,
  OCL_API_INVERT_SINGLE_WIDE, OCL_API_UNIFORMLYCONTROLLED, OCL_API_UNIFORMPARITYRZ, OCL_API_UNIFORMPARITYRZ_NORM,
  OCL_API_CUNIFORMPARITYRZ, OCL_API_COMPOSE, OCL_API_COMPOSE_WIDE, OCL_API_COMPOSE_MID,
  OCL_API_DECOMPOSEPROB, OCL_API_DECOMPOSEAMP, OCL_API_DISPOSEPROB, OCL_API_DISPOSE,
  OCL_API_PROB, OCL_API_PROBREG, OCL_API_PROBREGALL, OCL_API_PROBMASK,
  OCL_API_PROBMASKALL, OCL_API_PROBPARITY, OCL_API_FORCEMPARITY, OCL_API_EXPPERM,
  OCL_API_X_SINGLE, OCL_API_X_SINGLE_WIDE, OCL_API_X_MASK, OCL_API_Z_SINGLE,
  OCL_API_Z_SINGLE_WIDE, OCL_API_PHASE_PARITY, OCL_API_ROL, OCL_API_INC,
  OCL_API_CINC, OCL_API_INCDECC, OCL_API_INCS, OCL_API_INCDECSC_1,
  OCL_API_INCDECSC_2, OCL_API_INCBCD, OCL_API_INCDECBCDC, OCL_API_MUL,
  OCL_API_DIV, OCL_API_MULMODN_OUT, OCL_API_IMULMODN_OUT, OCL_API_POWMODN_OUT,
  OCL_API_CMUL, OCL_API_CDIV, OCL_API_CMULMODN_OUT, OCL_API_CIMULMODN_OUT,
  OCL_API_CPOWMODN_OUT, OCL_API_FULLADD, OCL_API_IFULLADD, OCL_API_INDEXEDLDA,
  OCL_API_INDEXEDADC, OCL_API_INDEXEDSBC, OCL_API_HASH, OCL_API_CPHASEFLIPIFLESS,
  OCL_API_PHASEFLIPIFLESS, OCL_API_APPROXCOMPARE, OCL_API_NORMALIZE, OCL_API_NORMALIZE_WIDE,
  OCL_API_UPDATENORM, OCL_API_APPLYM, OCL_API_APPLYMREG, OCL_API_CLEARBUFFER,
  OCL_API_SHUFFLEBUFFERS
}
 
enum  SPECIAL_2X2 {
  NONE = 0, PAULIX, PAULIZ, INVERT,
  PHASE
}
 
enum  Pauli { PauliI = 0, PauliX = 1, PauliY = 3, PauliZ = 2 }
 Enumerated list of Pauli bases. More...
 
enum  QInterfaceEngine {
  QINTERFACE_CPU = 0, QINTERFACE_OPENCL, QINTERFACE_HYBRID, QINTERFACE_BDT,
  QINTERFACE_MASK_FUSION, QINTERFACE_STABILIZER, QINTERFACE_STABILIZER_HYBRID, QINTERFACE_QPAGER,
  QINTERFACE_QUNIT, QINTERFACE_QUNIT_MULTI, QINTERFACE_OPTIMAL_SCHROEDINGER = QINTERFACE_CPU, QINTERFACE_OPTIMAL_SINGLE_PAGE = QINTERFACE_MASK_FUSION,
  QINTERFACE_OPTIMAL_BASE = QINTERFACE_CPU, QINTERFACE_OPTIMAL = QINTERFACE_QUNIT, QINTERFACE_OPTIMAL_MULTI = QINTERFACE_QUNIT_MULTI, QINTERFACE_MAX
}
 Enumerated list of supported engines. More...
 

Functions

Complex16x2Simd dupeLo (const Complex16x2Simd &cmplx2)
 
Complex16x2Simd dupeHi (const Complex16x2Simd &cmplx2)
 
Complex16x2Simd matrixMul (const Complex16x2Simd &mtrxCol1, const Complex16x2Simd &mtrxCol2, const Complex16x2Simd &qubit)
 
Complex16x2Simd matrixMul (const double &nrm, const Complex16x2Simd &mtrxCol1, const Complex16x2Simd &mtrxCol2, const Complex16x2Simd &qubit)
 
Complex16x2Simd operator* (const double lhs, const Complex16x2Simd &rhs)
 
double norm (const Complex16x2Simd &c)
 
Complex8x2Simd dupeLo (const Complex8x2Simd &cmplx2)
 
Complex8x2Simd dupeHi (const Complex8x2Simd &cmplx2)
 
Complex8x2Simd matrixMul (const Complex8x2Simd &mtrxCol1, const Complex8x2Simd &mtrxCol2, const Complex8x2Simd &qubit)
 
Complex8x2Simd matrixMul (const float &nrm, const Complex8x2Simd &mtrxCol1, const Complex8x2Simd &mtrxCol2, const Complex8x2Simd &qubit)
 
Complex8x2Simd operator* (const float lhs, const Complex8x2Simd &rhs)
 
float norm (const Complex8x2Simd &c)
 
bitCapInt pow2 (const bitLenInt &p)
 
bitCapIntOcl pow2Ocl (const bitLenInt &p)
 
bitCapInt pow2Mask (const bitLenInt &p)
 
bitCapIntOcl pow2MaskOcl (const bitLenInt &p)
 
bitLenInt log2 (bitCapInt n)
 
bitCapInt bitSlice (const bitLenInt &bit, const bitCapInt &source)
 
bitCapIntOcl bitSliceOcl (const bitLenInt &bit, const bitCapIntOcl &source)
 
bitCapInt bitRegMask (const bitLenInt &start, const bitLenInt &length)
 
bitCapIntOcl bitRegMaskOcl (const bitLenInt &start, const bitLenInt &length)
 
bool isPowerOfTwo (const bitCapInt &x)
 
unsigned char * cl_alloc (size_t ucharCount)
 
void cl_free (void *toFree)
 
void mul2x2 (const complex *left, const complex *right, complex *out)
 
void exp2x2 (const complex *matrix2x2, complex *outMatrix2x2)
 
void log2x2 (const complex *matrix2x2, complex *outMatrix2x2)
 
void inv2x2 (const complex *matrix2x2, complex *outMatrix2x2)
 
bool isOverflowAdd (bitCapInt inOutInt, bitCapInt inInt, const bitCapInt &signMask, const bitCapInt &lengthPower)
 Check if an addition with overflow sets the flag. More...
 
bool isOverflowSub (bitCapInt inOutInt, bitCapInt inInt, const bitCapInt &signMask, const bitCapInt &lengthPower)
 Check if a subtraction with overflow sets the flag. More...
 
bitCapInt pushApartBits (const bitCapInt &perm, const bitCapInt *skipPowers, const bitLenInt skipPowersCount)
 
bitCapInt intPow (bitCapInt base, bitCapInt power)
 
bitCapIntOcl intPowOcl (bitCapIntOcl base, bitCapIntOcl power)
 
bool operator== (const QBdtNodeInterfacePtr &lhs, const QBdtNodeInterfacePtr &rhs)
 
bool operator!= (const QBdtNodeInterfacePtr &lhs, const QBdtNodeInterfacePtr &rhs)
 
QBdtNodeInterfacePtr operator- (const QBdtNodeInterfacePtr &t)
 
template<class BidirectionalIterator >
void reverse (BidirectionalIterator first, BidirectionalIterator last, bitCapInt stride)
 
template<class BidirectionalIterator >
void rotate (BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, bitCapInt stride)
 
template<typename... Ts>
QInterfacePtr CreateQuantumInterface (QInterfaceEngine engine1, QInterfaceEngine engine2, QInterfaceEngine engine3, Ts... args)
 Factory method to create specific engine implementations. More...
 
template<typename... Ts>
QInterfacePtr CreateQuantumInterface (QInterfaceEngine engine1, QInterfaceEngine engine2, Ts... args)
 
template<typename... Ts>
QInterfacePtr CreateQuantumInterface (QInterfaceEngine engine, Ts... args)
 
template<typename... Ts>
QInterfacePtr CreateQuantumInterface (std::vector< QInterfaceEngine > engines, Ts... args)
 
void _expLog2x2 (const complex *matrix2x2, complex *outMatrix2x2, bool isExp)
 
bool getRdRand (unsigned *pv)
 
void CL_CALLBACK _PopQueue (cl_event event, cl_int type, void *user_data)
 
 GATE_1_INVERT (X, ONE_CMPLX, ONE_CMPLX)
 NOT gate, which is also Pauli x matrix. More...
 
 GATE_1_INVERT (Y, -I_CMPLX, I_CMPLX)
 Apply Pauli Y matrix to bit. More...
 
 GATE_1_PHASE (Z, ONE_CMPLX, -ONE_CMPLX)
 Apply Pauli Z matrix to bit. More...
 
 GATE_1_BIT (H, C_SQRT1_2, C_SQRT1_2, C_SQRT1_2, -C_SQRT1_2)
 Hadamard gate. More...
 
 GATE_1_BIT (SH, C_SQRT1_2, C_SQRT1_2, C_I_SQRT1_2, -C_I_SQRT1_2)
 Y-basis transformation gate. More...
 
 GATE_1_BIT (HIS, C_SQRT1_2, -C_I_SQRT1_2, C_SQRT1_2, C_I_SQRT1_2)
 Inverse Y-basis transformation gate. More...
 
 GATE_1_BIT (SqrtH, complex((real1)((ONE_R1+SQRT2_R1)/(2 *SQRT2_R1)),(real1)((-ONE_R1+SQRT2_R1)/(2 *SQRT2_R1))), complex((real1)(SQRT1_2_R1/2),(real1)(-SQRT1_2_R1/2)), complex((real1)(SQRT1_2_R1/2),(real1)(-SQRT1_2_R1/2)), complex((real1)((-ONE_R1+SQRT2_R1)/(2 *SQRT2_R1)),(real1)((ONE_R1+SQRT2_R1)/(2 *SQRT2_R1))))
 Square root of Hadamard gate. More...
 
 GATE_1_BIT (SqrtX, ONE_PLUS_I_DIV_2, ONE_MINUS_I_DIV_2, ONE_MINUS_I_DIV_2, ONE_PLUS_I_DIV_2)
 Square root of NOT gate. More...
 
 GATE_1_BIT (ISqrtX, ONE_MINUS_I_DIV_2, ONE_PLUS_I_DIV_2, ONE_PLUS_I_DIV_2, ONE_MINUS_I_DIV_2)
 Inverse square root of NOT gate. More...
 
 GATE_1_BIT (SqrtXConjT, ONE_PLUS_I_DIV_2, -C_I_SQRT1_2, C_SQRT1_2, ONE_PLUS_I_DIV_2)
 Phased square root of NOT gate. More...
 
 GATE_1_BIT (ISqrtXConjT, ONE_MINUS_I_DIV_2, C_SQRT1_2, C_I_SQRT1_2, ONE_MINUS_I_DIV_2)
 Inverse phased square root of NOT gate. More...
 
 GATE_1_BIT (SqrtY, ONE_PLUS_I_DIV_2, -ONE_PLUS_I_DIV_2, ONE_PLUS_I_DIV_2, ONE_PLUS_I_DIV_2)
 Apply Pauli Y matrix to bit. More...
 
 GATE_1_BIT (ISqrtY, ONE_MINUS_I_DIV_2, ONE_MINUS_I_DIV_2, -ONE_MINUS_I_DIV_2, ONE_MINUS_I_DIV_2)
 Apply Pauli Y matrix to bit. More...
 
 REG_GATE_1 (H)
 Apply Hadamard gate to each bit in "length," starting from bit index "start". More...
 
 REG_GATE_1 (X)
 Apply X ("not") gate to each bit in "length," starting from bit index "start". More...
 
real1_f dyadAngle (int numerator, int denomPower)
 

Variables

static const __m128 SIGNMASK = _mm_set_ps(0.0f, -0.0f, 0.0f, -0.0f)
 

Typedef Documentation

◆ BdtFunc

typedef std::function<bitCapInt(const bitCapInt&, const unsigned& cpu)> Qrack::BdtFunc

◆ BitOp

typedef std::shared_ptr<complex> Qrack::BitOp

◆ BufferPtr

typedef std::shared_ptr<cl::Buffer> Qrack::BufferPtr

◆ complex

typedef std::complex<half_float::half> Qrack::complex

◆ DeviceContextPtr

typedef std::shared_ptr<OCLDeviceContext> Qrack::DeviceContextPtr

◆ EventVecPtr

typedef std::shared_ptr<std::vector<cl::Event> > Qrack::EventVecPtr

◆ Hamiltonian

typedef std::vector<HamiltonianOpPtr> Qrack::Hamiltonian

◆ HamiltonianOpPtr

typedef std::shared_ptr<HamiltonianOp> Qrack::HamiltonianOpPtr

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.

To specify Hamiltonians with interaction terms, arbitrary sets of control bits may be specified for each term, in which case the term is acted only if the (superposable) control bits are true. The "antiCtrled" bool flips the overall convention, such that the term is acted only if all control bits are false. Additionally, for a combination of control bits and "anti-control" bits, an array of booleans, "ctrlToggles," of length "ctrlLen" may be specified that flips the activation state for each control bit, (relative the global anti- on/off convention,) without altering the state of the control bits.

The point of this "toggle" behavior is to allow enumeration of arbitrary local Hamiltonian terms with permutations of a set of control bits. For example, a Hamiltonian might represent an array of local electromagnetic potential wells. If there are 4 wells, each with independent potentials, control "toggles" could be used on two control bits, to enumerate all four permutations of two control bits with four different local Hamiltonian terms.

Warning
Hamiltonian components might not commute.

As a general point of linear algebra, where A and B are linear operators, e^{i * (A + B) * t} = e^{i * A * t} * e^{i * B * t} might NOT hold, if the operators A and B do not commute. As a rule of thumb, A will commute with B at least in the case that A and B act on entirely different sets of qubits. However, for defining the intended Hamiltonian, the programmer can be guaranteed that the exponential factors will be applied right-to-left, by left multiplication, in the order e^(i * H_(N - 1) * t) * e^(i * H_(N - 2) * t) * ... e^(i * H_0 * t) * |psi>. (For example, if A and B are single bit gates acting on the same bit, form their composition into one gate by the intended right-to-left fusion and apply them as a single HamiltonianOp.)

◆ IncrementFunc

typedef std::function<bitCapIntOcl(const bitCapIntOcl&, const unsigned& cpu)> Qrack::IncrementFunc

◆ MpsShardPtr

typedef std::shared_ptr<MpsShard> Qrack::MpsShardPtr

◆ ParallelFunc

typedef std::function<void(const bitCapIntOcl&, const unsigned& cpu)> Qrack::ParallelFunc

Called once per value between begin and end.

◆ PhaseShardPtr

typedef std::shared_ptr<PhaseShard> Qrack::PhaseShardPtr

◆ PoolItemPtr

typedef std::shared_ptr<PoolItem> Qrack::PoolItemPtr

◆ QAluPtr

typedef std::shared_ptr<QAlu> Qrack::QAluPtr

◆ QBdtNodeInterfacePtr

◆ QBdtNodePtr

typedef std::shared_ptr<QBdtNode> Qrack::QBdtNodePtr

◆ QBdtPtr

typedef std::shared_ptr<QBdt> Qrack::QBdtPtr

◆ QBdtQEngineNodePtr

typedef std::shared_ptr<QBdtQEngineNode> Qrack::QBdtQEngineNodePtr

◆ QBdtQInterfaceNodePtr

◆ QEngineCPUPtr

typedef std::shared_ptr<QEngineCPU> Qrack::QEngineCPUPtr

◆ QEngineOCLPtr

typedef std::shared_ptr<QEngineOCL> Qrack::QEngineOCLPtr

◆ QEnginePtr

typedef std::shared_ptr< QEngine > Qrack::QEnginePtr

◆ QEngineShardPtr

◆ QHybridPtr

typedef std::shared_ptr<QHybrid> Qrack::QHybridPtr

◆ QInterfacePtr

typedef std::shared_ptr<QInterface> Qrack::QInterfacePtr

◆ QMaskFusionPtr

typedef std::shared_ptr<QMaskFusion> Qrack::QMaskFusionPtr

◆ QNeuronPtr

typedef std::shared_ptr<QNeuron> Qrack::QNeuronPtr

◆ QPagerPtr

typedef std::shared_ptr<QPager> Qrack::QPagerPtr

◆ QParityPtr

typedef std::shared_ptr<QParity> Qrack::QParityPtr

◆ QStabilizerHybridPtr

◆ QStabilizerPtr

typedef std::shared_ptr<QStabilizer> Qrack::QStabilizerPtr

◆ QUnitMultiPtr

typedef std::shared_ptr<QUnitMulti> Qrack::QUnitMultiPtr

◆ QUnitPtr

typedef std::shared_ptr<QUnit> Qrack::QUnitPtr

◆ real1

◆ real1_f

typedef float Qrack::real1_f

◆ ShardToPhaseMap

◆ StateVectorArrayPtr

typedef std::shared_ptr<StateVectorArray> Qrack::StateVectorArrayPtr

◆ StateVectorPtr

typedef std::shared_ptr<StateVector> Qrack::StateVectorPtr

◆ StateVectorSparsePtr

Enumeration Type Documentation

◆ OCLAPI

Enumerator
OCL_API_UNKNOWN 
OCL_API_APPLY2X2 
OCL_API_APPLY2X2_SINGLE 
OCL_API_APPLY2X2_NORM_SINGLE 
OCL_API_APPLY2X2_DOUBLE 
OCL_API_APPLY2X2_WIDE 
OCL_API_APPLY2X2_SINGLE_WIDE 
OCL_API_APPLY2X2_NORM_SINGLE_WIDE 
OCL_API_APPLY2X2_DOUBLE_WIDE 
OCL_API_PHASE_SINGLE 
OCL_API_PHASE_SINGLE_WIDE 
OCL_API_INVERT_SINGLE 
OCL_API_INVERT_SINGLE_WIDE 
OCL_API_UNIFORMLYCONTROLLED 
OCL_API_UNIFORMPARITYRZ 
OCL_API_UNIFORMPARITYRZ_NORM 
OCL_API_CUNIFORMPARITYRZ 
OCL_API_COMPOSE 
OCL_API_COMPOSE_WIDE 
OCL_API_COMPOSE_MID 
OCL_API_DECOMPOSEPROB 
OCL_API_DECOMPOSEAMP 
OCL_API_DISPOSEPROB 
OCL_API_DISPOSE 
OCL_API_PROB 
OCL_API_PROBREG 
OCL_API_PROBREGALL 
OCL_API_PROBMASK 
OCL_API_PROBMASKALL 
OCL_API_PROBPARITY 
OCL_API_FORCEMPARITY 
OCL_API_EXPPERM 
OCL_API_X_SINGLE 
OCL_API_X_SINGLE_WIDE 
OCL_API_X_MASK 
OCL_API_Z_SINGLE 
OCL_API_Z_SINGLE_WIDE 
OCL_API_PHASE_PARITY 
OCL_API_ROL 
OCL_API_INC 
OCL_API_CINC 
OCL_API_INCDECC 
OCL_API_INCS 
OCL_API_INCDECSC_1 
OCL_API_INCDECSC_2 
OCL_API_INCBCD 
OCL_API_INCDECBCDC 
OCL_API_MUL 
OCL_API_DIV 
OCL_API_MULMODN_OUT 
OCL_API_IMULMODN_OUT 
OCL_API_POWMODN_OUT 
OCL_API_CMUL 
OCL_API_CDIV 
OCL_API_CMULMODN_OUT 
OCL_API_CIMULMODN_OUT 
OCL_API_CPOWMODN_OUT 
OCL_API_FULLADD 
OCL_API_IFULLADD 
OCL_API_INDEXEDLDA 
OCL_API_INDEXEDADC 
OCL_API_INDEXEDSBC 
OCL_API_HASH 
OCL_API_CPHASEFLIPIFLESS 
OCL_API_PHASEFLIPIFLESS 
OCL_API_APPROXCOMPARE 
OCL_API_NORMALIZE 
OCL_API_NORMALIZE_WIDE 
OCL_API_UPDATENORM 
OCL_API_APPLYM 
OCL_API_APPLYMREG 
OCL_API_CLEARBUFFER 
OCL_API_SHUFFLEBUFFERS 

◆ Pauli

Enumerated list of Pauli bases.

Enumerator
PauliI 

Pauli Identity operator. Corresponds to Q# constant "PauliI.".

PauliX 

Pauli X operator. Corresponds to Q# constant "PauliX.".

PauliY 

Pauli Y operator. Corresponds to Q# constant "PauliY.".

PauliZ 

Pauli Z operator. Corresponds to Q# constant "PauliZ.".

◆ QInterfaceEngine

Enumerated list of supported engines.

Use QINTERFACE_OPTIMAL for the best supported engine.

Enumerator
QINTERFACE_CPU 

Create a QEngineCPU leveraging only local CPU and memory resources.

QINTERFACE_OPENCL 

Create a QEngineOCL, leveraging OpenCL hardware to increase the speed of certain calculations.

QINTERFACE_HYBRID 

Create a QHybrid, switching between QEngineCPU and QEngineOCL as efficient.

QINTERFACE_BDT 

Create a QBinaryDecisionTree, (CPU-based).

QINTERFACE_MASK_FUSION 

Create a QMaskFusion, coalescing Pauli gates.

QINTERFACE_STABILIZER 

Create a QStabilizer, limited to Clifford/Pauli operations, but efficient.

QINTERFACE_STABILIZER_HYBRID 

Create a QStabilizerHybrid, switching between a QStabilizer and a QHybrid as efficient.

QINTERFACE_QPAGER 

Create a QPager, which breaks up the work of a QEngine into equally sized "pages.".

QINTERFACE_QUNIT 

Create a QUnit, which utilizes other QInterface classes to minimize the amount of work that's needed for any given operation based on the entanglement of the bits involved.

This, combined with QINTERFACE_OPTIMAL, is the recommended object to use as a library consumer.

QINTERFACE_QUNIT_MULTI 

Create a QUnitMulti, which distributes the explicitly separated "shards" of a QUnit across available OpenCL devices.

QINTERFACE_OPTIMAL_SCHROEDINGER 
QINTERFACE_OPTIMAL_SINGLE_PAGE 
QINTERFACE_OPTIMAL_BASE 
QINTERFACE_OPTIMAL 
QINTERFACE_OPTIMAL_MULTI 
QINTERFACE_MAX 

◆ SPECIAL_2X2

Enumerator
NONE 
PAULIX 
PAULIZ 
INVERT 
PHASE 

Function Documentation

◆ _expLog2x2()

void Qrack::_expLog2x2 ( const complex matrix2x2,
complex outMatrix2x2,
bool  isExp 
)

◆ _PopQueue()

void CL_CALLBACK Qrack::_PopQueue ( cl_event  event,
cl_int  type,
void *  user_data 
)

◆ bitRegMask()

bitCapInt Qrack::bitRegMask ( const bitLenInt start,
const bitLenInt length 
)
inline

◆ bitRegMaskOcl()

bitCapIntOcl Qrack::bitRegMaskOcl ( const bitLenInt start,
const bitLenInt length 
)
inline

◆ bitSlice()

bitCapInt Qrack::bitSlice ( const bitLenInt bit,
const bitCapInt source 
)
inline

◆ bitSliceOcl()

bitCapIntOcl Qrack::bitSliceOcl ( const bitLenInt bit,
const bitCapIntOcl source 
)
inline

◆ cl_alloc()

unsigned char * Qrack::cl_alloc ( size_t  ucharCount)

◆ cl_free()

void Qrack::cl_free ( void *  toFree)

◆ CreateQuantumInterface() [1/4]

template<typename... Ts>
QInterfacePtr Qrack::CreateQuantumInterface ( QInterfaceEngine  engine1,
QInterfaceEngine  engine2,
QInterfaceEngine  engine3,
Ts...  args 
)

Factory method to create specific engine implementations.

◆ CreateQuantumInterface() [2/4]

template<typename... Ts>
QInterfacePtr Qrack::CreateQuantumInterface ( QInterfaceEngine  engine1,
QInterfaceEngine  engine2,
Ts...  args 
)

◆ CreateQuantumInterface() [3/4]

template<typename... Ts>
QInterfacePtr Qrack::CreateQuantumInterface ( QInterfaceEngine  engine,
Ts...  args 
)

◆ CreateQuantumInterface() [4/4]

template<typename... Ts>
QInterfacePtr Qrack::CreateQuantumInterface ( std::vector< QInterfaceEngine engines,
Ts...  args 
)

◆ dupeHi() [1/2]

Complex8x2Simd Qrack::dupeHi ( const Complex8x2Simd cmplx2)
inline

◆ dupeHi() [2/2]

Complex16x2Simd Qrack::dupeHi ( const Complex16x2Simd cmplx2)
inline

◆ dupeLo() [1/2]

Complex16x2Simd Qrack::dupeLo ( const Complex16x2Simd cmplx2)
inline

◆ dupeLo() [2/2]

Complex8x2Simd Qrack::dupeLo ( const Complex8x2Simd cmplx2)
inline

◆ dyadAngle()

real1_f Qrack::dyadAngle ( int  numerator,
int  denomPower 
)
inline

◆ exp2x2()

void Qrack::exp2x2 ( const complex matrix2x2,
complex outMatrix2x2 
)

◆ GATE_1_BIT() [1/10]

Qrack::GATE_1_BIT ( H  ,
C_SQRT1_2  ,
C_SQRT1_2  ,
C_SQRT1_2  ,
C_SQRT1_2 
)

Hadamard gate.

◆ GATE_1_BIT() [2/10]

Qrack::GATE_1_BIT ( SH  ,
C_SQRT1_2  ,
C_SQRT1_2  ,
C_I_SQRT1_2  ,
C_I_SQRT1_2 
)

Y-basis transformation gate.

◆ GATE_1_BIT() [3/10]

Qrack::GATE_1_BIT ( HIS  ,
C_SQRT1_2  ,
C_I_SQRT1_2,
C_SQRT1_2  ,
C_I_SQRT1_2   
)

Inverse Y-basis transformation gate.

◆ GATE_1_BIT() [4/10]

Qrack::GATE_1_BIT ( SqrtH  ,
complex((real1)((ONE_R1+SQRT2_R1)/(2 *SQRT2_R1)),(real1)((-ONE_R1+SQRT2_R1)/(2 *SQRT2_R1)))  ,
complex((real1)(SQRT1_2_R1/2),(real1)(-SQRT1_2_R1/2))  ,
complex((real1)(SQRT1_2_R1/2),(real1)(-SQRT1_2_R1/2))  ,
complex((real1)((-ONE_R1+SQRT2_R1)/(2 *SQRT2_R1)),(real1)((ONE_R1+SQRT2_R1)/(2 *SQRT2_R1)))   
)

Square root of Hadamard gate.

◆ GATE_1_BIT() [5/10]

Qrack::GATE_1_BIT ( SqrtX  ,
ONE_PLUS_I_DIV_2  ,
ONE_MINUS_I_DIV_2  ,
ONE_MINUS_I_DIV_2  ,
ONE_PLUS_I_DIV_2   
)

Square root of NOT gate.

◆ GATE_1_BIT() [6/10]

Qrack::GATE_1_BIT ( ISqrtX  ,
ONE_MINUS_I_DIV_2  ,
ONE_PLUS_I_DIV_2  ,
ONE_PLUS_I_DIV_2  ,
ONE_MINUS_I_DIV_2   
)

Inverse square root of NOT gate.

◆ GATE_1_BIT() [7/10]

Qrack::GATE_1_BIT ( SqrtXConjT  ,
ONE_PLUS_I_DIV_2  ,
C_I_SQRT1_2,
C_SQRT1_2  ,
ONE_PLUS_I_DIV_2   
)

Phased square root of NOT gate.

◆ GATE_1_BIT() [8/10]

Qrack::GATE_1_BIT ( ISqrtXConjT  ,
ONE_MINUS_I_DIV_2  ,
C_SQRT1_2  ,
C_I_SQRT1_2  ,
ONE_MINUS_I_DIV_2   
)

Inverse phased square root of NOT gate.

◆ GATE_1_BIT() [9/10]

Qrack::GATE_1_BIT ( SqrtY  ,
ONE_PLUS_I_DIV_2  ,
ONE_PLUS_I_DIV_2,
ONE_PLUS_I_DIV_2  ,
ONE_PLUS_I_DIV_2   
)

Apply Pauli Y matrix to bit.

◆ GATE_1_BIT() [10/10]

Qrack::GATE_1_BIT ( ISqrtY  ,
ONE_MINUS_I_DIV_2  ,
ONE_MINUS_I_DIV_2  ,
ONE_MINUS_I_DIV_2,
ONE_MINUS_I_DIV_2   
)

Apply Pauli Y matrix to bit.

◆ GATE_1_INVERT() [1/2]

Qrack::GATE_1_INVERT ( X  ,
ONE_CMPLX  ,
ONE_CMPLX   
)

NOT gate, which is also Pauli x matrix.

◆ GATE_1_INVERT() [2/2]

Qrack::GATE_1_INVERT ( Y  ,
I_CMPLX,
I_CMPLX   
)

Apply Pauli Y matrix to bit.

◆ GATE_1_PHASE()

Qrack::GATE_1_PHASE ( Z  ,
ONE_CMPLX  ,
ONE_CMPLX 
)

Apply Pauli Z matrix to bit.

◆ getRdRand()

bool Qrack::getRdRand ( unsigned *  pv)

◆ intPow()

bitCapInt Qrack::intPow ( bitCapInt  base,
bitCapInt  power 
)

◆ intPowOcl()

bitCapIntOcl Qrack::intPowOcl ( bitCapIntOcl  base,
bitCapIntOcl  power 
)

◆ inv2x2()

void Qrack::inv2x2 ( const complex matrix2x2,
complex outMatrix2x2 
)

◆ isOverflowAdd()

bool Qrack::isOverflowAdd ( bitCapInt  inOutInt,
bitCapInt  inInt,
const bitCapInt signMask,
const bitCapInt lengthPower 
)

Check if an addition with overflow sets the flag.

◆ isOverflowSub()

bool Qrack::isOverflowSub ( bitCapInt  inOutInt,
bitCapInt  inInt,
const bitCapInt signMask,
const bitCapInt lengthPower 
)

Check if a subtraction with overflow sets the flag.

◆ isPowerOfTwo()

bool Qrack::isPowerOfTwo ( const bitCapInt x)
inline

◆ log2()

bitLenInt Qrack::log2 ( bitCapInt  n)
inline

◆ log2x2()

void Qrack::log2x2 ( const complex matrix2x2,
complex outMatrix2x2 
)

◆ matrixMul() [1/4]

Complex8x2Simd Qrack::matrixMul ( const Complex8x2Simd mtrxCol1,
const Complex8x2Simd mtrxCol2,
const Complex8x2Simd qubit 
)
inline

◆ matrixMul() [2/4]

Complex16x2Simd Qrack::matrixMul ( const Complex16x2Simd mtrxCol1,
const Complex16x2Simd mtrxCol2,
const Complex16x2Simd qubit 
)
inline

◆ matrixMul() [3/4]

Complex8x2Simd Qrack::matrixMul ( const float &  nrm,
const Complex8x2Simd mtrxCol1,
const Complex8x2Simd mtrxCol2,
const Complex8x2Simd qubit 
)
inline

◆ matrixMul() [4/4]

Complex16x2Simd Qrack::matrixMul ( const double &  nrm,
const Complex16x2Simd mtrxCol1,
const Complex16x2Simd mtrxCol2,
const Complex16x2Simd qubit 
)
inline

◆ mul2x2()

void Qrack::mul2x2 ( const complex left,
const complex right,
complex out 
)

◆ norm() [1/2]

float Qrack::norm ( const Complex8x2Simd c)
inline

◆ norm() [2/2]

double Qrack::norm ( const Complex16x2Simd c)
inline

◆ operator!=()

bool Qrack::operator!= ( const QBdtNodeInterfacePtr lhs,
const QBdtNodeInterfacePtr rhs 
)

◆ operator*() [1/2]

Complex8x2Simd Qrack::operator* ( const float  lhs,
const Complex8x2Simd rhs 
)
inline

◆ operator*() [2/2]

Complex16x2Simd Qrack::operator* ( const double  lhs,
const Complex16x2Simd rhs 
)
inline

◆ operator-()

QBdtNodeInterfacePtr Qrack::operator- ( const QBdtNodeInterfacePtr t)

◆ operator==()

bool Qrack::operator== ( const QBdtNodeInterfacePtr lhs,
const QBdtNodeInterfacePtr rhs 
)

◆ pow2()

bitCapInt Qrack::pow2 ( const bitLenInt p)
inline

◆ pow2Mask()

bitCapInt Qrack::pow2Mask ( const bitLenInt p)
inline

◆ pow2MaskOcl()

bitCapIntOcl Qrack::pow2MaskOcl ( const bitLenInt p)
inline

◆ pow2Ocl()

bitCapIntOcl Qrack::pow2Ocl ( const bitLenInt p)
inline

◆ pushApartBits()

bitCapInt Qrack::pushApartBits ( const bitCapInt perm,
const bitCapInt skipPowers,
const bitLenInt  skipPowersCount 
)

◆ REG_GATE_1() [1/2]

Qrack::REG_GATE_1 ( H  )

Apply Hadamard gate to each bit in "length," starting from bit index "start".

◆ REG_GATE_1() [2/2]

Qrack::REG_GATE_1 ( X  )

Apply X ("not") gate to each bit in "length," starting from bit index "start".

◆ reverse()

template<class BidirectionalIterator >
void Qrack::reverse ( BidirectionalIterator  first,
BidirectionalIterator  last,
bitCapInt  stride 
)

◆ rotate()

template<class BidirectionalIterator >
void Qrack::rotate ( BidirectionalIterator  first,
BidirectionalIterator  middle,
BidirectionalIterator  last,
bitCapInt  stride 
)

Variable Documentation

◆ SIGNMASK

const __m128 Qrack::SIGNMASK = _mm_set_ps(0.0f, -0.0f, 0.0f, -0.0f)
static