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

GLOSSARY: bitLenInt - "bit-length integer" - unsigned integer ID of qubit position in register bitCapInt - "bit-capacity integer" - unsigned integer single-permutation value of a qubit register (typically "big integer") real1 - "real number (1-dimensional)" - floating-point real-valued number complex - "complex number" - floating-point complex-valued number (with two real1 component dimensions) quid - "quantum (simulator) unique identifier" - unsigned integer that indexes and IDs running simulators, circuits, and neurons. More...

Classes

union  complex2
 SIMD implementation of the double precision complex vector type of 2 complex numbers, only for AVX Apply2x2. More...
 
class  DispatchQueue
 
struct  OCLKernelHandle
 
class  OCLDeviceCall
 
class  OCLDeviceContext
 
struct  InitOClResult
 
class  OCLEngine
 "Qrack::OCLEngine" manages the single OpenCL context. More...
 
class  ParallelFor
 
class  RandSupportSingleton
 
class  RdRandom
 
struct  HamiltonianOp
 A Hamiltonian can be specified in terms of arbitrary controlled single bit gates, each one an "HamiltonianOp.". More...
 
struct  UniformHamiltonianOp
 
struct  MpsShard
 
class  QAlu
 
class  QBdt
 
class  QBdtNode
 
class  QBdtNodeInterface
 
class  QBdtHybrid
 A "Qrack::QBdtHybrid" internally switched between Qrack::QBdt and Qrack::QHybrid to maximize entanglement-dependent performance. More...
 
struct  QCircuitGate
 
class  QCircuit
 
class  QEngine
 Abstract QEngine implementation, for all "Schroedinger method" engines. More...
 
class  QEngineCPU
 General purpose QEngineCPU implementation. More...
 
struct  QueueItem
 
class  PoolItem
 
class  QEngineCUDA
 OpenCL enhanced QEngineCPU implementation. More...
 
class  bad_alloc
 
class  QEngineOCL
 OpenCL enhanced QEngineCPU implementation. More...
 
struct  PhaseShard
 Caches controlled gate phase between shards, (as a case of "gate fusion" optimization particularly useful to QUnit) 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  QInterfaceNoisy
 A "Qrack::QInterfaceNoisy" that wraps any other QInterface with a simple noise model. More...
 
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
 
struct  AmplitudeEntry
 
class  QStabilizer
 
struct  QUnitCliffordAmp
 
class  QStabilizerHybrid
 A "Qrack::QStabilizerHybrid" internally switched between Qrack::QStabilizer and Qrack::QEngine to maximize performance. More...
 
class  QTensorNetwork
 
class  QubitSwapMap
 
class  QUnit
 
struct  CliffordShard
 
class  QUnitClifford
 
struct  QEngineInfo
 
struct  DeviceInfo
 
class  QUnitMulti
 
struct  IdOffset
 
struct  QUnitStateVector
 
class  StateVector
 
class  StateVectorArray
 
struct  QubitIndexState
 
struct  QubitIntegerExpVar
 
struct  QubitRealExpVar
 
struct  QubitPauliBasis
 
struct  QubitU3Basis
 
struct  QubitMatrixBasis
 
struct  QubitU3BasisEigenVal
 
struct  QubitMatrixBasisEigenVal
 
struct  MapArithmeticResult2
 

Typedefs

typedef std::function< void(void)> DispatchFn
 
typedef std::shared_ptr< OCLDeviceContextDeviceContextPtr
 
typedef std::vector< cl::Event > EventVec
 
typedef std::shared_ptr< EventVecEventVecPtr
 
typedef half_float::half real1
 
typedef float real1_f
 
typedef float real1_s
 
typedef std::complex< real1complex
 
typedef std::shared_ptr< complexBitOp
 
typedef std::function< void(const bitCapIntOcl &, const unsigned &cpu)> ParallelFunc
 
typedef std::function< bitCapIntOcl(const bitCapIntOcl &)> IncrementFunc
 
typedef std::function< bitCapInt(const bitCapInt &)> BdtFunc
 
typedef std::function< void(const bitCapInt &, const unsigned &cpu)> ParallelFuncBdt
 
typedef std::shared_ptr< StateVectorStateVectorPtr
 
typedef std::shared_ptr< StateVectorArrayStateVectorArrayPtr
 
typedef std::shared_ptr< StateVectorSparse > StateVectorSparsePtr
 
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< QBdtHybridQBdtHybridPtr
 
typedef std::shared_ptr< QCircuitGateQCircuitGatePtr
 
typedef std::shared_ptr< QCircuitQCircuitPtr
 
typedef std::shared_ptr< QEngineCPUQEngineCPUPtr
 
typedef unsigned long cl_map_flags
 
typedef unsigned long cl_mem_flags
 
typedef std::shared_ptr< void > BufferPtr
 
typedef std::shared_ptr< QEngineCUDAQEngineCUDAPtr
 
typedef std::shared_ptr< PoolItemPoolItemPtr
 
typedef std::shared_ptr< QEngineOCLQEngineOCLPtr
 
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< QInterfaceNoisyQInterfaceNoisyPtr
 
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< QTensorNetworkQTensorNetworkPtr
 
typedef std::shared_ptr< QUnitQUnitPtr
 
typedef std::shared_ptr< QUnitCliffordQUnitCliffordPtr
 
typedef std::shared_ptr< QUnitMultiQUnitMultiPtr
 
typedef std::shared_ptr< QUnitStateVectorQUnitStateVectorPtr
 
typedef uint64_t quid
 

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_CPROB , 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_PHASE_MASK ,
  OCL_API_ROL , 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 , OCL_API_INC , OCL_API_CINC , OCL_API_INCDECC ,
  OCL_API_INCS , OCL_API_INCDECSC_1 , OCL_API_INCDECSC_2 , 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_INCBCD , OCL_API_INCDECBCDC
}
 
enum  Pauli { PauliI = 0 , PauliX = 1 , PauliY = 3 , PauliZ = 2 }
 Enumerated list of Pauli bases. More...
 
enum  QNeuronActivationFn {
  Sigmoid = 0 , ReLU = 1 , GeLU = 2 , Generalized_Logistic = 3 ,
  Leaky_ReLU = 4
}
 Enumerated list of activation functions. More...
 
enum  SPECIAL_2X2 {
  NONE = 0 , PAULIX , PAULIZ , INVERT ,
  PHASE
}
 
enum  QInterfaceEngine {
  QINTERFACE_CPU = 0 , QINTERFACE_OPENCL , QINTERFACE_CUDA , QINTERFACE_HYBRID ,
  QINTERFACE_BDT , QINTERFACE_BDT_HYBRID , QINTERFACE_STABILIZER , QINTERFACE_STABILIZER_HYBRID ,
  QINTERFACE_QPAGER , QINTERFACE_QUNIT , QINTERFACE_QUNIT_MULTI , QINTERFACE_QUNIT_CLIFFORD ,
  QINTERFACE_TENSOR_NETWORK , QINTERFACE_NOISY , QINTERFACE_OPTIMAL_SCHROEDINGER = QINTERFACE_CPU , QINTERFACE_OPTIMAL_BASE = QINTERFACE_CPU ,
  QINTERFACE_OPTIMAL = QINTERFACE_QUNIT , QINTERFACE_OPTIMAL_MULTI = QINTERFACE_QUNIT_MULTI , QINTERFACE_MAX
}
 Enumerated list of supported engines. More...
 

Functions

complex2 mtrxColShuff (const complex2 &mtrxCol)
 
complex2 matrixMul (const complex2 &mtrxCol1, const complex2 &mtrxCol2, const complex2 &mtrxCol1Shuff, const complex2 &mtrxCol2Shuff, const complex2 &qubit)
 
complex2 matrixMul (const float &nrm, const complex2 &mtrxCol1, const complex2 &mtrxCol2, const complex2 &mtrxCol1Shuff, const complex2 &mtrxCol2Shuff, const complex2 &qubit)
 
complex2 operator* (const double &lhs, const complex2 &rhs)
 
double norm (const complex2 &c)
 
complex2 operator* (const float &lhs, const complex2 &rhs)
 
bitLenInt log2Ocl (bitCapIntOcl n)
 
bitLenInt popCountOcl (bitCapIntOcl n)
 
int bi_log2 (const bitCapInt &n)
 
bitLenInt log2 (bitCapInt n)
 
bitCapInt pow2 (const bitLenInt &p)
 
bitCapIntOcl pow2Ocl (const bitLenInt &p)
 
bitCapInt pow2Mask (const bitLenInt &p)
 
bitCapIntOcl pow2MaskOcl (const bitLenInt &p)
 
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)
 
bool isPowerOfTwoOcl (const bitCapIntOcl &x)
 
bool isBadBitRange (const bitLenInt &start, const bitLenInt &length, const bitLenInt &qubitCount)
 
bool isBadPermRange (const bitCapIntOcl &start, const bitCapIntOcl &length, const bitCapIntOcl &maxQPowerOcl)
 
void ThrowIfQbIdArrayIsBad (const std::vector< bitLenInt > &controls, const bitLenInt &qubitCount, std::string message)
 
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 (bitCapIntOcl inOutInt, bitCapIntOcl inInt, const bitCapIntOcl &signMask, const bitCapIntOcl &lengthPower)
 Check if an addition with overflow sets the flag. More...
 
bool isOverflowSub (bitCapIntOcl inOutInt, bitCapIntOcl inInt, const bitCapIntOcl &signMask, const bitCapIntOcl &lengthPower)
 Check if a subtraction with overflow sets the flag. More...
 
bitCapInt pushApartBits (const bitCapInt &perm, const std::vector< bitCapInt > &skipPowers)
 
bitCapInt intPow (const bitCapInt &base, const bitCapInt &power)
 
bitCapIntOcl intPowOcl (bitCapIntOcl base, bitCapIntOcl power)
 
bool operator== (QBdtNodeInterfacePtr lhs, QBdtNodeInterfacePtr rhs)
 
bool operator!= (QBdtNodeInterfacePtr lhs, QBdtNodeInterfacePtr rhs)
 
std::ostream & operator<< (std::ostream &os, const QCircuitGatePtr g)
 
std::istream & operator>> (std::istream &os, QCircuitGatePtr &g)
 
std::ostream & operator<< (std::ostream &os, const QCircuitPtr g)
 
std::istream & operator>> (std::istream &os, QCircuitPtr &g)
 
template<class BidirectionalIterator >
void reverse (BidirectionalIterator first, BidirectionalIterator last, const bitCapInt &stride)
 
template<class BidirectionalIterator >
void rotate (BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, const 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)
 
template<typename... Ts>
QInterfacePtr CreateArrangedLayersFull (bool nw, bool md, bool sd, bool sh, bool bdt, bool pg, bool tn, bool hy, bool oc, Ts... args)
 
template<typename... Ts>
QInterfacePtr CreateArrangedLayers (bool md, bool sd, bool sh, bool bdt, bool pg, bool tn, bool hy, bool oc, Ts... args)
 
quid init_count_type (bitLenInt q, bool tn, bool md, bool sd, bool sh, bool bdt, bool pg, bool nw, bool hy, bool oc, bool hp)
 Options for simulator type in initialization (any set of options theoretically functions together): tn - "Tensor network" layer - JIT local circuit simplification, light-cone optimization md - "Multi-device" (TURN OFF IN SERIAL BUILDS) - distribute Schmidt-decomposed or factorized subsytems to different OpenCL devices. More...
 
quid init_count (bitLenInt q, bool dm)
 "Default optimal" (BQP-complete-targeted) simulator type initialization (with "direct memory" option) More...
 
quid init ()
 "Quasi-default constructor" (for an empty simulator) More...
 
quid init_clone (quid sid)
 "Clone" simulator (no-clone theorem does not apply to classical simulation) More...
 
quid init_qbdd_count (bitLenInt q)
 "Default optimal" (BQP-complete-targeted) simulator type initialization (with "direct memory" option) More...
 
void destroy (quid sid)
 "Destroy" or release simulator allocation More...
 
void seed (quid sid, unsigned s)
 "Seed" random number generator (if pseudo-random Mersenne twister is in use) More...
 
void set_concurrency (quid sid, unsigned p)
 Set CPU concurrency (if build isn't serial) More...
 
void allocateQubit (quid sid, bitLenInt qid)
 Allocate new qubit with ID. More...
 
bool release (quid sid, bitLenInt q)
 Release qubit ID. More...
 
bitLenInt num_qubits (quid sid)
 Total count of qubits in simulator instance. More...
 
void SetPermutation (quid sid, bitCapInt p)
 Set bit string permutation eigenstate of simulator instance. More...
 
void qstabilizer_out_to_file (quid sid, std::string f)
 Output stabilizer simulation tableau to file (or raise exception for "get_error()" if incompatible simulator type) More...
 
void qstabilizer_in_from_file (quid sid, std::string f)
 Initialize stabilizer simulation from a tableau file (or raise exception for "get_error()" if incompatible simulator type) More...
 
std::vector< real1ProbAll (quid sid, std::vector< bitLenInt > q)
 Get the probabilities of all permutations of the requested subset of qubits. More...
 
real1_f Prob (quid sid, bitLenInt q)
 Z-basis expectation value of qubit. More...
 
real1_f ProbRdm (quid sid, bitLenInt q)
 "Reduced density matrix" Z-basis expectation value of qubit More...
 
real1_f PermutationProb (quid sid, std::vector< QubitIndexState > q)
 Probability of specified (single) permutation of any arbitrary group of qubits. More...
 
real1_f PermutationProbRdm (quid sid, std::vector< QubitIndexState > q, bool r)
 "Reduced density matrix" probability of specified (single) permutation of any arbitrary group of qubits More...
 
real1_f PermutationExpectation (quid sid, std::vector< bitLenInt > q)
 Expectation value for bit-string integer equivalent of specified arbitrary group of qubits. More...
 
real1_f PermutationExpectationRdm (quid sid, std::vector< bitLenInt > q, bool r)
 "Reduced density matrix" expectation value for bit-string integer equivalent of specified arbitrary group of qubits More...
 
real1_f FactorizedExpectation (quid sid, std::vector< QubitIntegerExpVar > q)
 Expectation value for bit-string integer from group of qubits with per-qubit integer expectation value. More...
 
real1_f FactorizedExpectationRdm (quid sid, std::vector< QubitIntegerExpVar > q, bool r)
 "Reduced density matrix" Expectation value for bit-string integer from group of qubits with per-qubit integer expectation value More...
 
real1_f FactorizedExpectationFp (quid sid, std::vector< QubitRealExpVar > q)
 Expectation value for bit-string integer from group of qubits with per-qubit real1 expectation value. More...
 
real1_f FactorizedExpectationFpRdm (quid sid, std::vector< QubitRealExpVar > q, bool r)
 "Reduced density matrix" Expectation value for bit-string integer from group of qubits with per-qubit real1 expectation value More...
 
real1_f UnitaryExpectation (quid sid, std::vector< QubitU3Basis > q)
 Get the single-qubit (3-parameter) operator expectation value for the array of qubits and bases. More...
 
real1_f MatrixExpectation (quid sid, std::vector< QubitMatrixBasis > q)
 Get the single-qubit (2x2) operator expectation value for the array of qubits and bases. More...
 
real1_f UnitaryExpectationEigenVal (quid sid, std::vector< QubitU3BasisEigenVal > q)
 Get the single-qubit (3-parameter) operator expectation value for the array of qubits and bases. More...
 
real1_f MatrixExpectationEigenVal (quid sid, std::vector< QubitMatrixBasisEigenVal > q)
 Get the single-qubit (2x2) operator expectation value for the array of qubits and bases. More...
 
real1_f PauliExpectation (quid sid, std::vector< QubitPauliBasis > q)
 Pauli operator expectation value for the array of qubits and bases. More...
 
real1_f Variance (quid sid, std::vector< bitLenInt > q)
 Variance for bit-string integer equivalent of specified arbitrary group of qubits. More...
 
real1_f VarianceRdm (quid sid, std::vector< bitLenInt > q, bool r)
 "Reduced density matrix" variance for bit-string integer equivalent of specified arbitrary group of qubits More...
 
real1_f FactorizedVariance (quid sid, std::vector< QubitIntegerExpVar > q)
 Variance for bit-string integer from group of qubits with per-qubit integer variance. More...
 
real1_f FactorizedVarianceRdm (quid sid, std::vector< QubitIntegerExpVar > q, bool r)
 "Reduced density matrix" variance for bit-string integer from group of qubits with per-qubit integer variance More...
 
real1_f FactorizedVarianceFp (quid sid, std::vector< QubitRealExpVar > q)
 Variance for bit-string integer from group of qubits with per-qubit real1 variance. More...
 
real1_f FactorizedVarianceFpRdm (quid sid, std::vector< QubitRealExpVar > q, bool r)
 "Reduced density matrix" variance for bit-string integer from group of qubits with per-qubit real1 variance More...
 
real1_f UnitaryVariance (quid sid, std::vector< QubitU3Basis > q)
 Get the single-qubit (3-parameter) operator variance for the array of qubits and bases. More...
 
real1_f MatrixVariance (quid sid, std::vector< QubitMatrixBasis > q)
 Get the single-qubit (2x2) operator variance for the array of qubits and bases. More...
 
real1_f UnitaryVarianceEigenVal (quid sid, std::vector< QubitU3BasisEigenVal > q)
 Get the single-qubit (3-parameter) operator variance for the array of qubits and bases. More...
 
real1_f MatrixVarianceEigenVal (quid sid, std::vector< QubitMatrixBasisEigenVal > q)
 Get the single-qubit (2x2) operator variance for the array of qubits and bases. More...
 
real1_f PauliVariance (quid sid, std::vector< QubitPauliBasis > q)
 Pauli operator variance for the array of qubits and bases. More...
 
size_t random_choice (quid sid, std::vector< real1 > p)
 Select from a distribution of "p.size()" count of elements according to the discrete probabilities in "p.". More...
 
void PhaseParity (quid sid, real1_f lambda, std::vector< bitLenInt > q)
 Applies e^(i*angle) phase factor to all combinations of bits with odd parity, based upon permutations of qubits. More...
 
void PhaseRootN (quid sid, bitLenInt p, std::vector< bitLenInt > q)
 Applies a -2 * PI_R1 / (2^N) phase rotation to each qubit. More...
 
real1_f JointEnsembleProbability (quid sid, std::vector< QubitPauliBasis > q)
 Overall probability of any odd permutation of the masked set of bits. More...
 
bool M (quid sid, bitLenInt q)
 Measure single qubit (according to Born rules) and return the result. More...
 
bool ForceM (quid sid, bitLenInt q, bool r)
 (PSEUDO-QUANTUM:) Force measurement result of single qubit (and return the result) More...
 
bool Measure (quid sid, std::vector< QubitPauliBasis > q)
 Each in its specified Pauli basis, collapse an ensemble of qubits jointly via measurement. More...
 
bitCapInt MAll (quid sid)
 Measure all qubits (according to Born rules) and return the result as a bit string (integer). More...
 
std::vector< long long unsigned int > MeasureShots (quid sid, std::vector< bitLenInt > q, unsigned s)
 Repeat (Z-basis) measurement of a set of qubits for a count of "shots" (without collapsing the simulator) More...
 
void ResetAll (quid sid)
 Set simulator to |0> permutation state. More...
 
void X (quid sid, bitLenInt q)
 (External API) "X" Gate More...
 
void Y (quid sid, bitLenInt q)
 (External API) "Y" Gate More...
 
void Z (quid sid, bitLenInt q)
 (External API) "Z" Gate More...
 
void H (quid sid, bitLenInt q)
 (External API) Walsh-Hadamard transform applied for simulator ID and qubit ID More...
 
void S (quid sid, bitLenInt q)
 (External API) "S" Gate More...
 
void SX (quid sid, bitLenInt q)
 (External API) Square root of X gate More...
 
void SY (quid sid, bitLenInt q)
 (External API) Square root of Y gate More...
 
void T (quid sid, bitLenInt q)
 (External API) "T" Gate More...
 
void AdjS (quid sid, bitLenInt q)
 (External API) Inverse "S" Gate More...
 
void AdjSX (quid sid, bitLenInt q)
 (External API) Inverse square root of X gate More...
 
void AdjSY (quid sid, bitLenInt q)
 (External API) Inverse square root of Y gate More...
 
void AdjT (quid sid, bitLenInt q)
 (External API) Inverse "T" Gate More...
 
void U (quid sid, bitLenInt q, real1_f theta, real1_f phi, real1_f lambda)
 (External API) 3-parameter unitary gate More...
 
void Mtrx (quid sid, std::vector< complex > m, bitLenInt q)
 (External API) 2x2 complex matrix unitary gate More...
 
void MCX (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) Controlled "X" Gate More...
 
void MCY (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) Controlled "Y" Gate More...
 
void MCZ (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) Controlled "Z" Gate More...
 
void MCH (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) Controlled "H" Gate More...
 
void MCS (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) Controlled "S" Gate More...
 
void MCT (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) Controlled "T" Gate More...
 
void MCAdjS (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) Controlled Inverse "S" Gate More...
 
void MCAdjT (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) Controlled Inverse "T" Gate More...
 
void MCU (quid sid, std::vector< bitLenInt > c, bitLenInt q, real1_f theta, real1_f phi, real1_f lambda)
 (External API) Controlled 3-parameter unitary gate More...
 
void MCMtrx (quid sid, std::vector< bitLenInt > c, std::vector< complex > m, bitLenInt q)
 (External API) Controlled 2x2 complex matrix unitary gate More...
 
void MACX (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) "Anti-"Controlled "X" Gate More...
 
void MACY (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) "Anti-"Controlled "Y" Gate More...
 
void MACZ (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) "Anti-"Controlled "Z" Gate More...
 
void MACH (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) "Anti-"Controlled "H" Gate More...
 
void MACS (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) "Anti-"Controlled "S" Gate More...
 
void MACT (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) "Anti-"Controlled "T" Gate More...
 
void MACAdjS (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) "Anti-"Controlled Inverse "S" Gate More...
 
void MACAdjT (quid sid, std::vector< bitLenInt > c, bitLenInt q)
 (External API) "Anti-"Controlled Inverse "T" Gate More...
 
void MACU (quid sid, std::vector< bitLenInt > c, bitLenInt q, real1_f theta, real1_f phi, real1_f lambda)
 (External API) Controlled 3-parameter unitary gate More...
 
void MACMtrx (quid sid, std::vector< bitLenInt > c, std::vector< complex > m, bitLenInt q)
 (External API) Controlled 2x2 complex matrix unitary gate More...
 
void UCMtrx (quid sid, std::vector< bitLenInt > c, std::vector< complex > m, bitLenInt q, bitCapIntOcl p)
 Multi-controlled gate that activates only for the specified permutation of controls, "p". More...
 
void Multiplex1Mtrx (quid sid, std::vector< bitLenInt > c, bitLenInt q, std::vector< complex > m)
 Multi-controlled, single-target multiplexer gate. More...
 
void MX (quid sid, std::vector< bitLenInt > q)
 (External API) Multiple "X" Gate More...
 
void MY (quid sid, std::vector< bitLenInt > q)
 (External API) Multiple "Y" Gate More...
 
void MZ (quid sid, std::vector< bitLenInt > q)
 (External API) Multiple "Z" Gate More...
 
void R (quid sid, real1_f phi, QubitPauliBasis q)
 (External API) Rotation around Pauli axes More...
 
void MCR (quid sid, real1_f phi, std::vector< bitLenInt > c, QubitPauliBasis q)
 (External API) Controlled rotation around Pauli axes More...
 
void Exp (quid sid, real1_f phi, std::vector< QubitPauliBasis > q)
 (External API) Exponentiation of Pauli operators More...
 
void MCExp (quid sid, real1_f phi, std::vector< bitLenInt > cs, std::vector< QubitPauliBasis > q)
 (External API) Controlled exponentiation of Pauli operators More...
 
void SWAP (quid sid, bitLenInt qi1, bitLenInt qi2)
 
void ISWAP (quid sid, bitLenInt qi1, bitLenInt qi2)
 
void AdjISWAP (quid sid, bitLenInt qi1, bitLenInt qi2)
 
void FSim (quid sid, real1_f theta, real1_f phi, bitLenInt qi1, bitLenInt qi2)
 
void CSWAP (quid sid, std::vector< bitLenInt > c, bitLenInt qi1, bitLenInt qi2)
 
void ACSWAP (quid sid, std::vector< bitLenInt > c, bitLenInt qi1, bitLenInt qi2)
 
void Compose (quid sid1, quid sid2, std::vector< bitLenInt > q)
 
quid Decompose (quid sid, std::vector< bitLenInt > q)
 
void Dispose (quid sid, std::vector< bitLenInt > q)
 
void AND (quid sid, bitLenInt qi1, bitLenInt qi2, bitLenInt qo)
 
void OR (quid sid, bitLenInt qi1, bitLenInt qi2, bitLenInt qo)
 
void XOR (quid sid, bitLenInt qi1, bitLenInt qi2, bitLenInt qo)
 
void NAND (quid sid, bitLenInt qi1, bitLenInt qi2, bitLenInt qo)
 
void NOR (quid sid, bitLenInt qi1, bitLenInt qi2, bitLenInt qo)
 
void XNOR (quid sid, bitLenInt qi1, bitLenInt qi2, bitLenInt qo)
 
void CLAND (quid sid, bool ci, bitLenInt qi, bitLenInt qo)
 
void CLOR (quid sid, bool ci, bitLenInt qi, bitLenInt qo)
 
void CLXOR (quid sid, bool ci, bitLenInt qi, bitLenInt qo)
 
void CLNAND (quid sid, bool ci, bitLenInt qi, bitLenInt qo)
 
void CLNOR (quid sid, bool ci, bitLenInt qi, bitLenInt qo)
 
void CLXNOR (quid sid, bool ci, bitLenInt qi, bitLenInt qo)
 
void QFT (quid sid, std::vector< bitLenInt > q)
 Quantum Fourier Transform. More...
 
void IQFT (quid sid, std::vector< bitLenInt > q)
 (Inverse) Quantum Fourier Transform More...
 
void ADD (quid sid, bitCapInt a, std::vector< bitLenInt > q)
 
void SUB (quid sid, bitCapInt a, std::vector< bitLenInt > q)
 
void ADDS (quid sid, bitCapInt a, bitLenInt s, std::vector< bitLenInt > q)
 
void SUBS (quid sid, bitCapInt a, bitLenInt s, std::vector< bitLenInt > q)
 
void MCADD (quid sid, bitCapInt a, std::vector< bitLenInt > c, std::vector< bitLenInt > q)
 
void MCSUB (quid sid, bitCapInt a, std::vector< bitLenInt > c, std::vector< bitLenInt > q)
 
void MUL (quid sid, bitCapInt a, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
void DIV (quid sid, bitCapInt a, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
void MULN (quid sid, bitCapInt a, bitCapInt m, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
void DIVN (quid sid, bitCapInt a, bitCapInt m, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
void POWN (quid sid, bitCapInt a, bitCapInt m, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
void MCMUL (quid sid, bitCapInt a, std::vector< bitLenInt > c, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
void MCDIV (quid sid, bitCapInt a, std::vector< bitLenInt > c, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
void MCMULN (quid sid, bitCapInt a, std::vector< bitLenInt > c, bitCapInt m, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
void MCDIVN (quid sid, bitCapInt a, std::vector< bitLenInt > c, bitCapInt m, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
void MCPOWN (quid sid, bitCapInt a, std::vector< bitLenInt > c, bitCapInt m, std::vector< bitLenInt > q, std::vector< bitLenInt > o)
 
bool TrySeparate1Qb (quid sid, bitLenInt qi1)
 Try to factorize a single-qubit subsystem out of "bulk" simulator state. More...
 
bool TrySeparate2Qb (quid sid, bitLenInt qi1, bitLenInt qi2)
 Try to factorize a two-qubit subsystem out of "bulk" simulator state. More...
 
bool TrySeparateTol (quid sid, std::vector< bitLenInt > q, real1_f tol)
 Try to factorize a qubit subsystem out of "bulk" simulator state. More...
 
void Separate (quid sid, std::vector< bitLenInt > q)
 Force (inexact) factorization of qubit subsystem out of "bulk" simulator state. More...
 
double GetUnitaryFidelity (quid sid)
 Report fidelity for "Schmidt decomposition rounding parameter" (SDRP) and "near-Clifford rounding". More...
 
void ResetUnitaryFidelity (quid sid)
 Reset fidelity to 1 for "Schmidt decomposition rounding parameter" (SDRP) and "near-Clifford rounding". More...
 
void SetSdrp (quid sid, double sdrp)
 Set "Schmidt decomposition rounding parameter" (SDRP) value (see https://arxiv.org/abs/2304.14969) More...
 
void SetNcrp (quid sid, double sdrp)
 Set "Near-Clifford rounding parameter". More...
 
void SetReactiveSeparate (quid sid, bool irs)
 Turn off/on "reactive separation" feature (for less/more aggressive automatic state factorization) More...
 
void SetTInjection (quid sid, bool iti)
 Turn off/on "T-injection" feature (for "near-Clifford" simulation with RZ gates) More...
 
void SetNoiseParameter (quid sid, double np)
 Set noise parameter (for QInterfaceNoisy) More...
 
void Normalize (quid sid)
 Normalize the state (which should never be necessary unless Decompose() is "abused") More...
 
quid init_qneuron (quid sid, std::vector< bitLenInt > c, bitLenInt q, QNeuronActivationFn f, real1_f a, real1_f tol)
 Initialize a "quantum neuron" that takes a list of qubit "controls" for input and acts on a single "target" output qubit. More...
 
quid clone_qneuron (quid nid)
 "Clone" a quantum neuron (which is a classical state) More...
 
void destroy_qneuron (quid nid)
 "Destroy" or release simulator allocation More...
 
void set_qneuron_angles (quid nid, std::vector< real1 > angles)
 Set the (RY-rotation) angle parameters for each permutation of quantum neuron input qubits. More...
 
std::vector< real1get_qneuron_angles (quid nid)
 Get the (RY-rotation) angle parameters for each permutation of quantum neuron input qubits. More...
 
void set_qneuron_alpha (quid nid, real1_f alpha)
 Set the "leakage" parameter for "leaky" quantum neuron activation functions. More...
 
real1_f get_qneuron_alpha (quid nid)
 Get the "leakage" parameter for "leaky" quantum neuron activation functions. More...
 
void set_qneuron_activation_fn (quid nid, QNeuronActivationFn f)
 Set the activation function for a quantum neuron. More...
 
QNeuronActivationFn get_qneuron_activation_fn (quid nid)
 Get the activation function for a quantum neuron. More...
 
real1_f qneuron_predict (quid nid, bool e, bool r)
 Infer quantum neuron output from inputs (after training) More...
 
real1_f qneuron_unpredict (quid nid, bool e)
 Perform the inverse of quantum neuron inference (for "uncomputation") More...
 
real1_f qneuron_learn_cycle (quid nid, bool e)
 Train a quantum neuron for one epoch, and also uncompute the intermediate side-effects. More...
 
void qneuron_learn (quid nid, real1_f eta, bool e, bool r)
 Train a quantum neuron for one epoh (without uncomputing any intermediate side-effects) More...
 
void qneuron_learn_permutation (quid nid, real1_f eta, bool e, bool r)
 Train a quantum neuron for one epoch, assuming that the input state is a Z-basis eigenstate. More...
 
quid init_qcircuit (bool collapse, bool clifford)
 
quid init_qcircuit_clone (quid cid)
 
quid qcircuit_inverse (quid cid)
 
quid qcircuit_past_light_cone (quid cid, std::set< bitLenInt > q)
 
void destroy_qcircuit (quid cid)
 
bitLenInt get_qcircuit_qubit_count (quid cid)
 
void qcircuit_swap (quid cid, bitLenInt q1, bitLenInt q2)
 
void qcircuit_append_1qb (quid cid, std::vector< complex > m, bitLenInt q)
 
void qcircuit_append_mc (quid cid, std::vector< complex > m, std::vector< bitLenInt > c, bitLenInt q, bitCapInt p)
 
void qcircuit_run (quid cid, quid sid)
 
void qcircuit_out_to_file (quid cid, std::string f)
 
void qcircuit_in_from_file (quid cid, std::string f)
 
std::string qcircuit_out_to_string (quid cid)
 
void _expLog2x2 (const complex *matrix2x2, complex *outMatrix2x2, bool isExp)
 
std::vector< std::string > _readDirectoryFileNames (const std::string &path)
 
std::string _getDefaultRandomNumberFilePath ()
 
void CL_CALLBACK _PopQueue (cl_event event, cl_int type, void *user_data)
 
 REG_GATE_1 (H)
 Apply Hadamard gate to each bit in "length," starting from bit index "start". More...
 
real1_f dyadAngle (int numerator, int denomPower)
 
std::ostream & operator<< (std::ostream &os, const QStabilizerPtr s)
 
std::istream & operator>> (std::istream &is, const QStabilizerPtr s)
 
std::ostream & operator<< (std::ostream &os, const QStabilizerHybridPtr s)
 
std::istream & operator>> (std::istream &is, const QStabilizerHybridPtr s)
 
std::ostream & operator<< (std::ostream &os, const QUnitCliffordPtr s)
 
std::istream & operator>> (std::istream &is, const QUnitCliffordPtr s)
 
bitLenInt GetSimShardId (QInterfacePtr simulator, bitLenInt i)
 
void FillSimShards (QInterfacePtr simulator)
 
void TransformPauliBasis (QInterfacePtr simulator, std::vector< QubitPauliBasis > qb)
 
void RevertPauliBasis (QInterfacePtr simulator, std::vector< QubitPauliBasis > qb)
 
void removeIdentities (std::vector< QubitPauliBasis > *qb)
 
void RHelper (quid sid, real1_f phi, QubitPauliBasis qb)
 
void MCRHelper (quid sid, real1_f phi, std::vector< bitLenInt > c, QubitPauliBasis qb)
 
size_t make_mask (std::vector< QubitPauliBasis > const &qs)
 
std::map< quid, bitLenInt >::iterator FindShardValue (bitLenInt v, std::map< quid, bitLenInt > &simMap)
 
void SwapShardValues (bitLenInt v1, bitLenInt v2, std::map< quid, bitLenInt > &simMap)
 
bitLenInt MapArithmetic (QInterfacePtr simulator, std::vector< bitLenInt > q)
 
MapArithmeticResult2 MapArithmetic2 (QInterfacePtr simulator, std::vector< bitLenInt > q1, std::vector< bitLenInt > q2)
 
MapArithmeticResult2 MapArithmetic3 (QInterfacePtr simulator, std::vector< bitLenInt > q1, std::vector< bitLenInt > q2)
 
quid init_clone_size (quid sid, bitLenInt n)
 
void _PhaseMask (quid sid, real1_f lambda, bitLenInt p, std::vector< bitLenInt > q, bool isParity)
 
real1_f _JointEnsembleProbabilityHelper (QInterfacePtr simulator, std::vector< QubitPauliBasis > q, bool doMeasure)
 
real1_f _Prob (quid sid, bitLenInt q, bool isRdm)
 
real1_f _PermutationProb (quid sid, std::vector< QubitIndexState > q, bool isRdm, bool r)
 
real1_f _PermutationExpVar (quid sid, std::vector< bitLenInt > q, bool r, bool isRdm, bool isExp)
 
real1_f FactorizedExpVar (bool isExp, bool isRdm, quid sid, std::vector< QubitIntegerExpVar > q, bool r)
 
real1_f FactorizedExpVarFp (bool isExp, bool isRdm, quid sid, std::vector< QubitRealExpVar > q, bool r)
 
real1_f UnitaryExpVar (bool isExp, quid sid, std::vector< QubitU3Basis > q)
 
real1_f MatrixExpVar (bool isExp, quid sid, std::vector< QubitMatrixBasis > q)
 
real1_f UnitaryExpVarEigenVal (bool isExp, quid sid, std::vector< QubitU3BasisEigenVal > q)
 
real1_f MatrixExpVarEigenVal (bool isExp, quid sid, std::vector< QubitMatrixBasisEigenVal > q)
 
real1_f PauliExpVar (bool isExp, quid sid, std::vector< QubitPauliBasis > q)
 
quid _init_qcircuit_copy (quid cid, bool isInverse, std::set< bitLenInt > q)
 
void qcircuit_append_1qb (quid cid, std::vector< real1_f > m, bitLenInt q)
 
void qcircuit_append_mc (quid cid, std::vector< real1_f > m, std::vector< bitLenInt > c, bitLenInt q, bitCapInt p)
 

Variables

static const __m256d SIGNMASK = _mm256_set_pd(-0.0, -0.0, -0.0, -0.0)
 
static const __m128 SIGNMASK = _mm_set_ps(0.0f, -0.0f, 0.0f, -0.0f)
 
const real1_f _qrack_qunit_sep_thresh = FP_NORM_EPSILON
 
const real1_f _qrack_qbdt_sep_thresh = FP_NORM_EPSILON
 
const bitLenInt QRACK_MAX_CPU_QB_DEFAULT = -1
 
const bitLenInt QRACK_MAX_PAGE_QB_DEFAULT = QRACK_MAX_CPU_QB_DEFAULT
 
const bitLenInt QRACK_MAX_PAGING_QB_DEFAULT = QRACK_MAX_CPU_QB_DEFAULT
 
const bitLenInt QRACK_QRACK_QTENSORNETWORK_THRESHOLD_CPU_QB = 32U
 
const bitLenInt PSTRIDEPOW_DEFAULT = PSTRIDEPOW
 
const bitCapInt ONE_BCI = 1U
 
const bitCapInt ZERO_BCI = 0U
 
constexpr bitLenInt bitsInCap = ((bitLenInt)1U) << ((bitLenInt)QBCAPPOW)
 
QRACK_CONST real1 PI_R1 = (real1)M_PI
 
QRACK_CONST real1 SQRT2_R1 = (real1)M_SQRT2
 
QRACK_CONST real1 SQRT1_2_R1 = (real1)M_SQRT1_2
 
QRACK_CONST real1 ZERO_R1 = (real1)0.0f
 
QRACK_CONST real1 HALF_R1 = (real1)0.5f
 
QRACK_CONST real1 ONE_R1 = (real1)1.0f
 
QRACK_CONST real1 REAL1_EPSILON = (real1)0.000000477f
 
QRACK_CONST complex ONE_CMPLX = complex(ONE_R1, ZERO_R1)
 
QRACK_CONST complex ZERO_CMPLX = complex(ZERO_R1, ZERO_R1)
 
QRACK_CONST complex I_CMPLX = complex(ZERO_R1, ONE_R1)
 
QRACK_CONST complex HALF_I_HALF_CMPLX = complex(HALF_R1, HALF_R1)
 
QRACK_CONST complex HALF_NEG_I_HALF_CMPLX = complex(HALF_R1, -HALF_R1)
 
QRACK_CONST complex CMPLX_DEFAULT_ARG = complex((real1)REAL1_DEFAULT_ARG, (real1)REAL1_DEFAULT_ARG)
 
QRACK_CONST real1 FP_NORM_EPSILON = (real1)(std::numeric_limits<real1>::epsilon() / 4)
 
QRACK_CONST real1_f FP_NORM_EPSILON_F = (real1_f)FP_NORM_EPSILON
 
QRACK_CONST real1_f TRYDECOMPOSE_EPSILON = 32 * FP_NORM_EPSILON_F
 
const double FIDELITY_MIN = log((double)FP_NORM_EPSILON)
 
QRACK_CONST complex C_SQRT1_2 = complex(SQRT1_2_R1, ZERO_R1)
 
QRACK_CONST complex C_SQRT_I = complex(SQRT1_2_R1, SQRT1_2_R1)
 
QRACK_CONST complex C_SQRT_N_I = complex(SQRT1_2_R1, -SQRT1_2_R1)
 
QRACK_CONST complex I_CMPLX_NEG = complex(ZERO_R1, -ONE_R1)
 
QRACK_CONST complex C_SQRT1_2_NEG = complex(-SQRT1_2_R1, ZERO_R1)
 
qrack_rand_gen_ptr randNumGen = std::make_shared<qrack_rand_gen>(time(0))
 
std::mutex metaOperationMutex
 
std::vector< QInterfacePtrsimulators
 
std::vector< std::vector< QInterfaceEngine > > simulatorTypes
 
std::vector< bool > simulatorHostPointer
 
std::map< QInterface *, std::mutex > simulatorMutexes
 
std::vector< bool > simulatorReservations
 
std::map< QInterface *, std::map< quid, bitLenInt > > shards
 
std::vector< int > neuronErrors
 
std::vector< QNeuronPtrneurons
 
std::map< QNeuronPtr, QInterface * > neuronSimulators
 
std::map< QNeuron *, std::mutex > neuronMutexes
 
std::vector< bool > neuronReservations
 
std::vector< QCircuitPtrcircuits
 
std::map< QCircuit *, std::mutex > circuitMutexes
 
std::vector< bool > circuitReservations
 

Detailed Description

GLOSSARY: bitLenInt - "bit-length integer" - unsigned integer ID of qubit position in register bitCapInt - "bit-capacity integer" - unsigned integer single-permutation value of a qubit register (typically "big integer") real1 - "real number (1-dimensional)" - floating-point real-valued number complex - "complex number" - floating-point complex-valued number (with two real1 component dimensions) quid - "quantum (simulator) unique identifier" - unsigned integer that indexes and IDs running simulators, circuits, and neurons.

Typedef Documentation

◆ BdtFunc

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

◆ BitOp

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

◆ BufferPtr

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

◆ cl_map_flags

typedef unsigned long Qrack::cl_map_flags

◆ cl_mem_flags

typedef unsigned long Qrack::cl_mem_flags

◆ complex

typedef std::complex<real1> Qrack::complex

◆ DeviceContextPtr

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

◆ DispatchFn

typedef std::function< void(void)> Qrack::DispatchFn

◆ EventVec

typedef std::vector<cl::Event> Qrack::EventVec

◆ EventVecPtr

typedef std::shared_ptr<EventVec> 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&)> Qrack::IncrementFunc

◆ MpsShardPtr

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

◆ ParallelFunc

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

◆ ParallelFuncBdt

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

◆ PhaseShardPtr

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

◆ PoolItemPtr

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

◆ QAluPtr

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

◆ QBdtHybridPtr

typedef std::shared_ptr<QBdtHybrid> Qrack::QBdtHybridPtr

◆ QBdtNodeInterfacePtr

◆ QBdtNodePtr

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

◆ QBdtPtr

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

◆ QCircuitGatePtr

typedef std::shared_ptr<QCircuitGate> Qrack::QCircuitGatePtr

◆ QCircuitPtr

typedef std::shared_ptr<QCircuit> Qrack::QCircuitPtr

◆ QEngineCPUPtr

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

◆ QEngineCUDAPtr

typedef std::shared_ptr<QEngineCUDA> Qrack::QEngineCUDAPtr

◆ 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

◆ QInterfaceNoisyPtr

typedef std::shared_ptr<QInterfaceNoisy> Qrack::QInterfaceNoisyPtr

◆ QInterfacePtr

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

◆ 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

◆ QTensorNetworkPtr

typedef std::shared_ptr<QTensorNetwork> Qrack::QTensorNetworkPtr

◆ quid

typedef uint64_t Qrack::quid

◆ QUnitCliffordPtr

typedef std::shared_ptr<QUnitClifford> Qrack::QUnitCliffordPtr

◆ QUnitMultiPtr

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

◆ QUnitPtr

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

◆ QUnitStateVectorPtr

typedef std::shared_ptr<QUnitStateVector> Qrack::QUnitStateVectorPtr

◆ real1

◆ real1_f

typedef float Qrack::real1_f

◆ real1_s

typedef float Qrack::real1_s

◆ ShardToPhaseMap

◆ StateVectorArrayPtr

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

◆ StateVectorPtr

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

◆ StateVectorSparsePtr

typedef std::shared_ptr<StateVectorSparse> Qrack::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_CPROB 
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_PHASE_MASK 
OCL_API_ROL 
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 
OCL_API_INC 
OCL_API_CINC 
OCL_API_INCDECC 
OCL_API_INCS 
OCL_API_INCDECSC_1 
OCL_API_INCDECSC_2 
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_INCBCD 
OCL_API_INCDECBCDC 

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

Create a QEngineCUDA, leveraging CUDA 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_BDT_HYBRID 

Create a QBinaryDecisionTree, (CPU-based).

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_QUNIT_CLIFFORD 

Clifford-specialized QUnit.

QINTERFACE_TENSOR_NETWORK 

Circuit-simplification layer.

QINTERFACE_NOISY 

Noisy wrapper layer.

QINTERFACE_OPTIMAL_SCHROEDINGER 
QINTERFACE_OPTIMAL_BASE 
QINTERFACE_OPTIMAL 
QINTERFACE_OPTIMAL_MULTI 
QINTERFACE_MAX 

◆ QNeuronActivationFn

Enumerated list of activation functions.

Enumerator
Sigmoid 

Default.

ReLU 

Rectified linear.

GeLU 

Gaussian linear.

Generalized_Logistic 

Version of (default) "Sigmoid" with tunable sharpness.

Leaky_ReLU 

Leaky rectified linear.

◆ SPECIAL_2X2

Enumerator
NONE 
PAULIX 
PAULIZ 
INVERT 
PHASE 

Function Documentation

◆ _expLog2x2()

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

◆ _getDefaultRandomNumberFilePath()

std::string Qrack::_getDefaultRandomNumberFilePath ( )

◆ _init_qcircuit_copy()

quid Qrack::_init_qcircuit_copy ( quid  cid,
bool  isInverse,
std::set< bitLenInt q 
)

◆ _JointEnsembleProbabilityHelper()

real1_f Qrack::_JointEnsembleProbabilityHelper ( QInterfacePtr  simulator,
std::vector< QubitPauliBasis q,
bool  doMeasure 
)

◆ _PermutationExpVar()

real1_f Qrack::_PermutationExpVar ( quid  sid,
std::vector< bitLenInt q,
bool  r,
bool  isRdm,
bool  isExp 
)

◆ _PermutationProb()

real1_f Qrack::_PermutationProb ( quid  sid,
std::vector< QubitIndexState q,
bool  isRdm,
bool  r 
)

◆ _PhaseMask()

void Qrack::_PhaseMask ( quid  sid,
real1_f  lambda,
bitLenInt  p,
std::vector< bitLenInt q,
bool  isParity 
)

◆ _PopQueue()

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

◆ _Prob()

real1_f Qrack::_Prob ( quid  sid,
bitLenInt  q,
bool  isRdm 
)

◆ _readDirectoryFileNames()

std::vector<std::string> Qrack::_readDirectoryFileNames ( const std::string &  path)

◆ ACSWAP()

void Qrack::ACSWAP ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  qi1,
bitLenInt  qi2 
)

◆ ADD()

void Qrack::ADD ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt q 
)

◆ ADDS()

void Qrack::ADDS ( quid  sid,
bitCapInt  a,
bitLenInt  s,
std::vector< bitLenInt q 
)

◆ AdjISWAP()

void Qrack::AdjISWAP ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2 
)

◆ AdjS()

void Qrack::AdjS ( quid  sid,
bitLenInt  q 
)

(External API) Inverse "S" Gate

◆ AdjSX()

void Qrack::AdjSX ( quid  sid,
bitLenInt  q 
)

(External API) Inverse square root of X gate

◆ AdjSY()

void Qrack::AdjSY ( quid  sid,
bitLenInt  q 
)

(External API) Inverse square root of Y gate

◆ AdjT()

void Qrack::AdjT ( quid  sid,
bitLenInt  q 
)

(External API) Inverse "T" Gate

◆ allocateQubit()

void Qrack::allocateQubit ( quid  sid,
bitLenInt  qid 
)

Allocate new qubit with ID.

(External API) Allocate 1 new qubit with the given qubit ID, under the simulator ID

◆ AND()

void Qrack::AND ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2,
bitLenInt  qo 
)

◆ bi_log2()

int Qrack::bi_log2 ( const bitCapInt n)
inline

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

◆ CLAND()

void Qrack::CLAND ( quid  sid,
bool  ci,
bitLenInt  qi,
bitLenInt  qo 
)

◆ CLNAND()

void Qrack::CLNAND ( quid  sid,
bool  ci,
bitLenInt  qi,
bitLenInt  qo 
)

◆ CLNOR()

void Qrack::CLNOR ( quid  sid,
bool  ci,
bitLenInt  qi,
bitLenInt  qo 
)

◆ clone_qneuron()

quid Qrack::clone_qneuron ( quid  nid)

"Clone" a quantum neuron (which is a classical state)

◆ CLOR()

void Qrack::CLOR ( quid  sid,
bool  ci,
bitLenInt  qi,
bitLenInt  qo 
)

◆ CLXNOR()

void Qrack::CLXNOR ( quid  sid,
bool  ci,
bitLenInt  qi,
bitLenInt  qo 
)

◆ CLXOR()

void Qrack::CLXOR ( quid  sid,
bool  ci,
bitLenInt  qi,
bitLenInt  qo 
)

◆ Compose()

void Qrack::Compose ( quid  sid1,
quid  sid2,
std::vector< bitLenInt q 
)

◆ CreateArrangedLayers()

template<typename... Ts>
QInterfacePtr Qrack::CreateArrangedLayers ( bool  md,
bool  sd,
bool  sh,
bool  bdt,
bool  pg,
bool  tn,
bool  hy,
bool  oc,
Ts...  args 
)

◆ CreateArrangedLayersFull()

template<typename... Ts>
QInterfacePtr Qrack::CreateArrangedLayersFull ( bool  nw,
bool  md,
bool  sd,
bool  sh,
bool  bdt,
bool  pg,
bool  tn,
bool  hy,
bool  oc,
Ts...  args 
)

◆ CreateQuantumInterface() [1/4]

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

◆ CreateQuantumInterface() [2/4]

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

Factory method to create specific engine implementations.

◆ CreateQuantumInterface() [3/4]

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

◆ CreateQuantumInterface() [4/4]

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

◆ CSWAP()

void Qrack::CSWAP ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  qi1,
bitLenInt  qi2 
)

◆ Decompose()

quid Qrack::Decompose ( quid  sid,
std::vector< bitLenInt q 
)

◆ destroy()

void Qrack::destroy ( quid  sid)

"Destroy" or release simulator allocation

(External API) Destroy a simulator (ID will not be reused)

◆ destroy_qcircuit()

void Qrack::destroy_qcircuit ( quid  cid)

◆ destroy_qneuron()

void Qrack::destroy_qneuron ( quid  nid)

"Destroy" or release simulator allocation

◆ Dispose()

void Qrack::Dispose ( quid  sid,
std::vector< bitLenInt q 
)

◆ DIV()

void Qrack::DIV ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ DIVN()

void Qrack::DIVN ( quid  sid,
bitCapInt  a,
bitCapInt  m,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ dyadAngle()

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

◆ Exp()

void Qrack::Exp ( quid  sid,
real1_f  phi,
std::vector< QubitPauliBasis q 
)

(External API) Exponentiation of Pauli operators

◆ exp2x2()

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

◆ FactorizedExpectation()

real1_f Qrack::FactorizedExpectation ( quid  sid,
std::vector< QubitIntegerExpVar q 
)

Expectation value for bit-string integer from group of qubits with per-qubit integer expectation value.

(External API) Get the permutation expectation value, based upon the order of input qubits.

◆ FactorizedExpectationFp()

real1_f Qrack::FactorizedExpectationFp ( quid  sid,
std::vector< QubitRealExpVar q 
)

Expectation value for bit-string integer from group of qubits with per-qubit real1 expectation value.

(External API) Get the permutation expectation value, based upon the order of input qubits.

◆ FactorizedExpectationFpRdm()

real1_f Qrack::FactorizedExpectationFpRdm ( quid  sid,
std::vector< QubitRealExpVar q,
bool  r 
)

"Reduced density matrix" Expectation value for bit-string integer from group of qubits with per-qubit real1 expectation value

(External API) Get the permutation expectation value, based upon the order of input qubits, treating all ancillary qubits as post-selected T gate gadgets.

◆ FactorizedExpectationRdm()

real1_f Qrack::FactorizedExpectationRdm ( quid  sid,
std::vector< QubitIntegerExpVar q,
bool  r 
)

"Reduced density matrix" Expectation value for bit-string integer from group of qubits with per-qubit integer expectation value

(External API) Get the permutation expectation value, based upon the order of input qubits, treating all ancillary qubits as post-selected T gate gadgets.

◆ FactorizedExpVar()

real1_f Qrack::FactorizedExpVar ( bool  isExp,
bool  isRdm,
quid  sid,
std::vector< QubitIntegerExpVar q,
bool  r 
)

◆ FactorizedExpVarFp()

real1_f Qrack::FactorizedExpVarFp ( bool  isExp,
bool  isRdm,
quid  sid,
std::vector< QubitRealExpVar q,
bool  r 
)

◆ FactorizedVariance()

real1_f Qrack::FactorizedVariance ( quid  sid,
std::vector< QubitIntegerExpVar q 
)

Variance for bit-string integer from group of qubits with per-qubit integer variance.

(External API) Get the permutation variance, based upon the order of input qubits.

◆ FactorizedVarianceFp()

real1_f Qrack::FactorizedVarianceFp ( quid  sid,
std::vector< QubitRealExpVar q 
)

Variance for bit-string integer from group of qubits with per-qubit real1 variance.

(External API) Get the permutation variance, based upon the order of input qubits.

◆ FactorizedVarianceFpRdm()

real1_f Qrack::FactorizedVarianceFpRdm ( quid  sid,
std::vector< QubitRealExpVar q,
bool  r 
)

"Reduced density matrix" variance for bit-string integer from group of qubits with per-qubit real1 variance

(External API) Get the permutation variance, based upon the order of input qubits, treating all ancillary qubits as post-selected T gate gadgets.

◆ FactorizedVarianceRdm()

real1_f Qrack::FactorizedVarianceRdm ( quid  sid,
std::vector< QubitIntegerExpVar q,
bool  r 
)

"Reduced density matrix" variance for bit-string integer from group of qubits with per-qubit integer variance

(External API) Get the permutation variance, based upon the order of input qubits, treating all ancillary qubits as post-selected T gate gadgets.

◆ FillSimShards()

void Qrack::FillSimShards ( QInterfacePtr  simulator)

◆ FindShardValue()

std::map<quid, bitLenInt>::iterator Qrack::FindShardValue ( bitLenInt  v,
std::map< quid, bitLenInt > &  simMap 
)

◆ ForceM()

bool Qrack::ForceM ( quid  sid,
bitLenInt  q,
bool  r 
)

(PSEUDO-QUANTUM:) Force measurement result of single qubit (and return the result)

(External API) PSEUDO-QUANTUM: Post-select bit in |0>/|1> basis

◆ FSim()

void Qrack::FSim ( quid  sid,
real1_f  theta,
real1_f  phi,
bitLenInt  qi1,
bitLenInt  qi2 
)

◆ get_qcircuit_qubit_count()

bitLenInt Qrack::get_qcircuit_qubit_count ( quid  cid)

◆ get_qneuron_activation_fn()

QNeuronActivationFn Qrack::get_qneuron_activation_fn ( quid  nid)

Get the activation function for a quantum neuron.

◆ get_qneuron_alpha()

real1_f Qrack::get_qneuron_alpha ( quid  nid)

Get the "leakage" parameter for "leaky" quantum neuron activation functions.

◆ get_qneuron_angles()

std::vector< real1 > Qrack::get_qneuron_angles ( quid  nid)

Get the (RY-rotation) angle parameters for each permutation of quantum neuron input qubits.

◆ GetSimShardId()

bitLenInt Qrack::GetSimShardId ( QInterfacePtr  simulator,
bitLenInt  i 
)

◆ GetUnitaryFidelity()

double Qrack::GetUnitaryFidelity ( quid  sid)

Report fidelity for "Schmidt decomposition rounding parameter" (SDRP) and "near-Clifford rounding".

◆ H()

void Qrack::H ( quid  sid,
bitLenInt  q 
)

(External API) Walsh-Hadamard transform applied for simulator ID and qubit ID

◆ init()

quid Qrack::init ( )

"Quasi-default constructor" (for an empty simulator)

◆ init_clone()

quid Qrack::init_clone ( quid  sid)

"Clone" simulator (no-clone theorem does not apply to classical simulation)

(External API) Initialize a simulator ID that clones simulator ID "sid"

◆ init_clone_size()

quid Qrack::init_clone_size ( quid  sid,
bitLenInt  n 
)

◆ init_count()

quid Qrack::init_count ( bitLenInt  q,
bool  dm 
)

"Default optimal" (BQP-complete-targeted) simulator type initialization (with "direct memory" option)

(External API) Initialize a simulator ID with "q" qubits and implicit default layer options.

◆ init_count_type()

quid Qrack::init_count_type ( bitLenInt  q,
bool  tn,
bool  md,
bool  sd,
bool  sh,
bool  bdt,
bool  pg,
bool  nw,
bool  hy,
bool  oc,
bool  hp 
)

Options for simulator type in initialization (any set of options theoretically functions together): tn - "Tensor network" layer - JIT local circuit simplification, light-cone optimization md - "Multi-device" (TURN OFF IN SERIAL BUILDS) - distribute Schmidt-decomposed or factorized subsytems to different OpenCL devices.

(External API) Initialize a simulator ID with "q" qubits and explicit layer options on/off

sd - "Schmidt decomposition" - use state-factorization optimizations sh - "Stabilizer hybrid" - use ("hybrid") stabilizer and near-Clifford optimizations (does not work well with "tn," "tensor network") bdt - "Binary decision tree" - use "quantum binary decision diagram" (QBDD) optimization. This can optionally "hybridize" with state vector, for speed. pg - "Pager" (TURN OFF IN SERIAL BUILDS) - split large simulations into a power-of-2 of smaller simulation "pages," for multi-device distribution hy - "(State vector) Hybrid" (TURN OFF IN SERIAL BUILD) - for state vector, "hybridize" CPU/GPU/multi-GPU simulation qubit width thresholds, for speed. oc - "OpenCL" (TURN OFF IN SERIAL BUILD) - use OpenCL acceleration (in general) hp - "Host pointer" (TURN OFF IN SERIAL BUILD) - allocate OpenCL state vectors on "host" instead of "device" (useful for certain accelerators, like Intel HD)

◆ init_qbdd_count()

quid Qrack::init_qbdd_count ( bitLenInt  q)

"Default optimal" (BQP-complete-targeted) simulator type initialization (with "direct memory" option)

(External API) Initialize a simulator ID with "q" qubits and implicit default layer options.

◆ init_qcircuit()

quid Qrack::init_qcircuit ( bool  collapse,
bool  clifford 
)

◆ init_qcircuit_clone()

quid Qrack::init_qcircuit_clone ( quid  cid)

◆ init_qneuron()

quid Qrack::init_qneuron ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q,
QNeuronActivationFn  f,
real1_f  a,
real1_f  tol 
)

Initialize a "quantum neuron" that takes a list of qubit "controls" for input and acts on a single "target" output qubit.

◆ intPow()

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

◆ intPowOcl()

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

◆ inv2x2()

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

◆ IQFT()

void Qrack::IQFT ( quid  sid,
std::vector< bitLenInt q 
)

(Inverse) Quantum Fourier Transform

◆ isBadBitRange()

bool Qrack::isBadBitRange ( const bitLenInt start,
const bitLenInt length,
const bitLenInt qubitCount 
)
inline

◆ isBadPermRange()

bool Qrack::isBadPermRange ( const bitCapIntOcl start,
const bitCapIntOcl length,
const bitCapIntOcl maxQPowerOcl 
)
inline

◆ isOverflowAdd()

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

Check if an addition with overflow sets the flag.

◆ isOverflowSub()

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

Check if a subtraction with overflow sets the flag.

◆ isPowerOfTwo()

bool Qrack::isPowerOfTwo ( const bitCapInt x)
inline

◆ isPowerOfTwoOcl()

bool Qrack::isPowerOfTwoOcl ( const bitCapIntOcl x)
inline

◆ ISWAP()

void Qrack::ISWAP ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2 
)

◆ JointEnsembleProbability()

real1_f Qrack::JointEnsembleProbability ( quid  sid,
std::vector< QubitPauliBasis q 
)

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

(External API) Find the joint probability for all specified qubits under the respective Pauli basis transformations.

◆ log2()

bitLenInt Qrack::log2 ( bitCapInt  n)
inline

◆ log2Ocl()

bitLenInt Qrack::log2Ocl ( bitCapIntOcl  n)
inline

◆ log2x2()

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

◆ M()

bool Qrack::M ( quid  sid,
bitLenInt  q 
)

Measure single qubit (according to Born rules) and return the result.

(External API) Measure bit in |0>/|1> basis

◆ MACAdjS()

void Qrack::MACAdjS ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) "Anti-"Controlled Inverse "S" Gate

◆ MACAdjT()

void Qrack::MACAdjT ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) "Anti-"Controlled Inverse "T" Gate

◆ MACH()

void Qrack::MACH ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) "Anti-"Controlled "H" Gate

◆ MACMtrx()

void Qrack::MACMtrx ( quid  sid,
std::vector< bitLenInt c,
std::vector< complex m,
bitLenInt  q 
)

(External API) Controlled 2x2 complex matrix unitary gate

◆ MACS()

void Qrack::MACS ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) "Anti-"Controlled "S" Gate

◆ MACT()

void Qrack::MACT ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) "Anti-"Controlled "T" Gate

◆ MACU()

void Qrack::MACU ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q,
real1_f  theta,
real1_f  phi,
real1_f  lambda 
)

(External API) Controlled 3-parameter unitary gate

◆ MACX()

void Qrack::MACX ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) "Anti-"Controlled "X" Gate

◆ MACY()

void Qrack::MACY ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) "Anti-"Controlled "Y" Gate

◆ MACZ()

void Qrack::MACZ ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) "Anti-"Controlled "Z" Gate

◆ make_mask()

size_t Qrack::make_mask ( std::vector< QubitPauliBasis > const &  qs)
inline

◆ MAll()

bitCapInt Qrack::MAll ( quid  sid)

Measure all qubits (according to Born rules) and return the result as a bit string (integer).

(External API) Measure all bits separately in |0>/|1> basis, and return the result in low-to-high order corresponding with first-to-last in original order of allocation.

◆ MapArithmetic()

bitLenInt Qrack::MapArithmetic ( QInterfacePtr  simulator,
std::vector< bitLenInt q 
)

◆ MapArithmetic2()

MapArithmeticResult2 Qrack::MapArithmetic2 ( QInterfacePtr  simulator,
std::vector< bitLenInt q1,
std::vector< bitLenInt q2 
)

◆ MapArithmetic3()

MapArithmeticResult2 Qrack::MapArithmetic3 ( QInterfacePtr  simulator,
std::vector< bitLenInt q1,
std::vector< bitLenInt q2 
)

◆ MatrixExpectation()

real1_f Qrack::MatrixExpectation ( quid  sid,
std::vector< QubitMatrixBasis q 
)

Get the single-qubit (2x2) operator expectation value for the array of qubits and bases.

(External API) Get the single-qubit (2x2) operator expectation value for the array of qubits and bases.

◆ MatrixExpectationEigenVal()

real1_f Qrack::MatrixExpectationEigenVal ( quid  sid,
std::vector< QubitMatrixBasisEigenVal q 
)

Get the single-qubit (2x2) operator expectation value for the array of qubits and bases.

(External API) Get the single-qubit (2x2) operator expectation value for the array of qubits and bases.

◆ MatrixExpVar()

real1_f Qrack::MatrixExpVar ( bool  isExp,
quid  sid,
std::vector< QubitMatrixBasis q 
)

◆ MatrixExpVarEigenVal()

real1_f Qrack::MatrixExpVarEigenVal ( bool  isExp,
quid  sid,
std::vector< QubitMatrixBasisEigenVal q 
)

◆ matrixMul() [1/2]

complex2 Qrack::matrixMul ( const complex2 mtrxCol1,
const complex2 mtrxCol2,
const complex2 mtrxCol1Shuff,
const complex2 mtrxCol2Shuff,
const complex2 qubit 
)
inline

◆ matrixMul() [2/2]

complex2 Qrack::matrixMul ( const float &  nrm,
const complex2 mtrxCol1,
const complex2 mtrxCol2,
const complex2 mtrxCol1Shuff,
const complex2 mtrxCol2Shuff,
const complex2 qubit 
)
inline

◆ MatrixVariance()

real1_f Qrack::MatrixVariance ( quid  sid,
std::vector< QubitMatrixBasis q 
)

Get the single-qubit (2x2) operator variance for the array of qubits and bases.

(External API) Get the single-qubit (2x2) operator variance for the array of qubits and bases.

◆ MatrixVarianceEigenVal()

real1_f Qrack::MatrixVarianceEigenVal ( quid  sid,
std::vector< QubitMatrixBasisEigenVal q 
)

Get the single-qubit (2x2) operator variance for the array of qubits and bases.

(External API) Get the single-qubit (2x2) operator variance for the array of qubits and bases.

◆ MCADD()

void Qrack::MCADD ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt c,
std::vector< bitLenInt q 
)

◆ MCAdjS()

void Qrack::MCAdjS ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) Controlled Inverse "S" Gate

◆ MCAdjT()

void Qrack::MCAdjT ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) Controlled Inverse "T" Gate

◆ MCDIV()

void Qrack::MCDIV ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt c,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ MCDIVN()

void Qrack::MCDIVN ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt c,
bitCapInt  m,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ MCExp()

void Qrack::MCExp ( quid  sid,
real1_f  phi,
std::vector< bitLenInt c,
std::vector< QubitPauliBasis q 
)

(External API) Controlled exponentiation of Pauli operators

◆ MCH()

void Qrack::MCH ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) Controlled "H" Gate

◆ MCMtrx()

void Qrack::MCMtrx ( quid  sid,
std::vector< bitLenInt c,
std::vector< complex m,
bitLenInt  q 
)

(External API) Controlled 2x2 complex matrix unitary gate

◆ MCMUL()

void Qrack::MCMUL ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt c,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ MCMULN()

void Qrack::MCMULN ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt c,
bitCapInt  m,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ MCPOWN()

void Qrack::MCPOWN ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt c,
bitCapInt  m,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ MCR()

void Qrack::MCR ( quid  sid,
real1_f  phi,
std::vector< bitLenInt c,
QubitPauliBasis  q 
)

(External API) Controlled rotation around Pauli axes

◆ MCRHelper()

void Qrack::MCRHelper ( quid  sid,
real1_f  phi,
std::vector< bitLenInt c,
QubitPauliBasis  qb 
)

◆ MCS()

void Qrack::MCS ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) Controlled "S" Gate

◆ MCSUB()

void Qrack::MCSUB ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt c,
std::vector< bitLenInt q 
)

◆ MCT()

void Qrack::MCT ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) Controlled "T" Gate

◆ MCU()

void Qrack::MCU ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q,
real1_f  theta,
real1_f  phi,
real1_f  lambda 
)

(External API) Controlled 3-parameter unitary gate

◆ MCX()

void Qrack::MCX ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) Controlled "X" Gate

◆ MCY()

void Qrack::MCY ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) Controlled "Y" Gate

◆ MCZ()

void Qrack::MCZ ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q 
)

(External API) Controlled "Z" Gate

◆ Measure()

bool Qrack::Measure ( quid  sid,
std::vector< QubitPauliBasis q 
)

Each in its specified Pauli basis, collapse an ensemble of qubits jointly via measurement.

(External API) Measure bits in specified Pauli bases

◆ MeasureShots()

std::vector< long long unsigned int > Qrack::MeasureShots ( quid  sid,
std::vector< bitLenInt q,
unsigned  s 
)

Repeat (Z-basis) measurement of a set of qubits for a count of "shots" (without collapsing the simulator)

◆ Mtrx()

void Qrack::Mtrx ( quid  sid,
std::vector< complex m,
bitLenInt  q 
)

(External API) 2x2 complex matrix unitary gate

◆ mtrxColShuff()

complex2 Qrack::mtrxColShuff ( const complex2 mtrxCol)
inline

◆ MUL()

void Qrack::MUL ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ mul2x2()

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

◆ MULN()

void Qrack::MULN ( quid  sid,
bitCapInt  a,
bitCapInt  m,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ Multiplex1Mtrx()

void Qrack::Multiplex1Mtrx ( quid  sid,
std::vector< bitLenInt c,
bitLenInt  q,
std::vector< complex m 
)

Multi-controlled, single-target multiplexer gate.

◆ MX()

void Qrack::MX ( quid  sid,
std::vector< bitLenInt q 
)

(External API) Multiple "X" Gate

◆ MY()

void Qrack::MY ( quid  sid,
std::vector< bitLenInt q 
)

(External API) Multiple "Y" Gate

◆ MZ()

void Qrack::MZ ( quid  sid,
std::vector< bitLenInt q 
)

(External API) Multiple "Z" Gate

◆ NAND()

void Qrack::NAND ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2,
bitLenInt  qo 
)

◆ NOR()

void Qrack::NOR ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2,
bitLenInt  qo 
)

◆ norm()

float Qrack::norm ( const complex2 c)
inline

◆ Normalize()

void Qrack::Normalize ( quid  sid)

Normalize the state (which should never be necessary unless Decompose() is "abused")

◆ num_qubits()

bitLenInt Qrack::num_qubits ( quid  sid)

Total count of qubits in simulator instance.

◆ operator!=()

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

◆ operator*() [1/2]

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

◆ operator*() [2/2]

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

◆ operator<<() [1/5]

std::ostream & Qrack::operator<< ( std::ostream &  os,
const QCircuitGatePtr  g 
)

◆ operator<<() [2/5]

std::ostream & Qrack::operator<< ( std::ostream &  os,
const QCircuitPtr  g 
)

◆ operator<<() [3/5]

std::ostream& Qrack::operator<< ( std::ostream &  os,
const QStabilizerHybridPtr  s 
)

◆ operator<<() [4/5]

std::ostream& Qrack::operator<< ( std::ostream &  os,
const QStabilizerPtr  s 
)

◆ operator<<() [5/5]

std::ostream& Qrack::operator<< ( std::ostream &  os,
const QUnitCliffordPtr  s 
)

◆ operator==()

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

◆ operator>>() [1/5]

std::istream& Qrack::operator>> ( std::istream &  is,
const QStabilizerHybridPtr  s 
)

◆ operator>>() [2/5]

std::istream& Qrack::operator>> ( std::istream &  is,
const QStabilizerPtr  s 
)

◆ operator>>() [3/5]

std::istream& Qrack::operator>> ( std::istream &  is,
const QUnitCliffordPtr  s 
)

◆ operator>>() [4/5]

std::istream & Qrack::operator>> ( std::istream &  os,
QCircuitGatePtr g 
)

◆ operator>>() [5/5]

std::istream & Qrack::operator>> ( std::istream &  os,
QCircuitPtr g 
)

◆ OR()

void Qrack::OR ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2,
bitLenInt  qo 
)

◆ PauliExpectation()

real1_f Qrack::PauliExpectation ( quid  sid,
std::vector< QubitPauliBasis q 
)

Pauli operator expectation value for the array of qubits and bases.

(External API) Get the Pauli operator expectation value for the array of qubits and bases.

◆ PauliExpVar()

real1_f Qrack::PauliExpVar ( bool  isExp,
quid  sid,
std::vector< QubitPauliBasis q 
)

◆ PauliVariance()

real1_f Qrack::PauliVariance ( quid  sid,
std::vector< QubitPauliBasis q 
)

Pauli operator variance for the array of qubits and bases.

(External API) Get the Pauli operator variance for the array of qubits and bases.

◆ PermutationExpectation()

real1_f Qrack::PermutationExpectation ( quid  sid,
std::vector< bitLenInt q 
)

Expectation value for bit-string integer equivalent of specified arbitrary group of qubits.

(External API) Get the permutation expectation value, based upon the order of input qubits.

◆ PermutationExpectationRdm()

real1_f Qrack::PermutationExpectationRdm ( quid  sid,
std::vector< bitLenInt q,
bool  r 
)

"Reduced density matrix" expectation value for bit-string integer equivalent of specified arbitrary group of qubits

(External API) Get the permutation expectation value, based upon the order of input qubits, treating all ancillary qubits as post-selected T gate gadgets.

◆ PermutationProb()

real1_f Qrack::PermutationProb ( quid  sid,
std::vector< QubitIndexState q 
)

Probability of specified (single) permutation of any arbitrary group of qubits.

(External API) Get the permutation expectation value, based upon the order of input qubits.

◆ PermutationProbRdm()

real1_f Qrack::PermutationProbRdm ( quid  sid,
std::vector< QubitIndexState q,
bool  r 
)

"Reduced density matrix" probability of specified (single) permutation of any arbitrary group of qubits

(External API) Get the permutation expectation value, based upon the order of input qubits, treating all ancillary qubits as post-selected T gate gadgets.

◆ PhaseParity()

void Qrack::PhaseParity ( quid  sid,
real1_f  lambda,
std::vector< bitLenInt q 
)

Applies e^(i*angle) phase factor to all combinations of bits with odd parity, based upon permutations of qubits.

◆ PhaseRootN()

void Qrack::PhaseRootN ( quid  sid,
bitLenInt  p,
std::vector< bitLenInt q 
)

Applies a -2 * PI_R1 / (2^N) phase rotation to each qubit.

◆ popCountOcl()

bitLenInt Qrack::popCountOcl ( bitCapIntOcl  n)
inline

◆ 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

◆ POWN()

void Qrack::POWN ( quid  sid,
bitCapInt  a,
bitCapInt  m,
std::vector< bitLenInt q,
std::vector< bitLenInt o 
)

◆ Prob()

real1_f Qrack::Prob ( quid  sid,
bitLenInt  q 
)

Z-basis expectation value of qubit.

(External API) Get the probability that a qubit is in the |1> state.

◆ ProbAll()

std::vector< real1 > Qrack::ProbAll ( quid  sid,
std::vector< bitLenInt q 
)

Get the probabilities of all permutations of the requested subset of qubits.

◆ ProbRdm()

real1_f Qrack::ProbRdm ( quid  sid,
bitLenInt  q 
)

"Reduced density matrix" Z-basis expectation value of qubit

(External API) Get the probability that a qubit is in the |1> state, treating all ancillary qubits as post-selected T gate gadgets.

◆ pushApartBits()

bitCapInt Qrack::pushApartBits ( const bitCapInt perm,
const std::vector< bitCapInt > &  skipPowers 
)

◆ qcircuit_append_1qb() [1/2]

void Qrack::qcircuit_append_1qb ( quid  cid,
std::vector< complex m,
bitLenInt  q 
)

◆ qcircuit_append_1qb() [2/2]

void Qrack::qcircuit_append_1qb ( quid  cid,
std::vector< real1_f m,
bitLenInt  q 
)

◆ qcircuit_append_mc() [1/2]

void Qrack::qcircuit_append_mc ( quid  cid,
std::vector< complex m,
std::vector< bitLenInt c,
bitLenInt  q,
bitCapInt  p 
)

◆ qcircuit_append_mc() [2/2]

void Qrack::qcircuit_append_mc ( quid  cid,
std::vector< real1_f m,
std::vector< bitLenInt c,
bitLenInt  q,
bitCapInt  p 
)

◆ qcircuit_in_from_file()

void Qrack::qcircuit_in_from_file ( quid  cid,
std::string  f 
)

◆ qcircuit_inverse()

quid Qrack::qcircuit_inverse ( quid  cid)

◆ qcircuit_out_to_file()

void Qrack::qcircuit_out_to_file ( quid  cid,
std::string  f 
)

◆ qcircuit_out_to_string()

std::string Qrack::qcircuit_out_to_string ( quid  cid)

◆ qcircuit_past_light_cone()

quid Qrack::qcircuit_past_light_cone ( quid  cid,
std::set< bitLenInt q 
)

◆ qcircuit_run()

void Qrack::qcircuit_run ( quid  cid,
quid  sid 
)

◆ qcircuit_swap()

void Qrack::qcircuit_swap ( quid  cid,
bitLenInt  q1,
bitLenInt  q2 
)

◆ QFT()

void Qrack::QFT ( quid  sid,
std::vector< bitLenInt q 
)

Quantum Fourier Transform.

◆ qneuron_learn()

void Qrack::qneuron_learn ( quid  nid,
real1_f  eta,
bool  e,
bool  r 
)

Train a quantum neuron for one epoh (without uncomputing any intermediate side-effects)

◆ qneuron_learn_cycle()

real1_f Qrack::qneuron_learn_cycle ( quid  nid,
bool  e 
)

Train a quantum neuron for one epoch, and also uncompute the intermediate side-effects.

◆ qneuron_learn_permutation()

void Qrack::qneuron_learn_permutation ( quid  nid,
real1_f  eta,
bool  e,
bool  r 
)

Train a quantum neuron for one epoch, assuming that the input state is a Z-basis eigenstate.

◆ qneuron_predict()

real1_f Qrack::qneuron_predict ( quid  nid,
bool  e,
bool  r 
)

Infer quantum neuron output from inputs (after training)

◆ qneuron_unpredict()

real1_f Qrack::qneuron_unpredict ( quid  nid,
bool  e 
)

Perform the inverse of quantum neuron inference (for "uncomputation")

◆ qstabilizer_in_from_file()

void Qrack::qstabilizer_in_from_file ( quid  sid,
std::string  f 
)

Initialize stabilizer simulation from a tableau file (or raise exception for "get_error()" if incompatible simulator type)

◆ qstabilizer_out_to_file()

void Qrack::qstabilizer_out_to_file ( quid  sid,
std::string  f 
)

Output stabilizer simulation tableau to file (or raise exception for "get_error()" if incompatible simulator type)

◆ R()

void Qrack::R ( quid  sid,
real1_f  phi,
QubitPauliBasis  q 
)

(External API) Rotation around Pauli axes

◆ random_choice()

size_t Qrack::random_choice ( quid  sid,
std::vector< real1 p 
)

Select from a distribution of "p.size()" count of elements according to the discrete probabilities in "p.".

Select from a distribution of "p.size()" count of elements according the discrete probabilities in "p.".

◆ REG_GATE_1()

Qrack::REG_GATE_1 ( H  )

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

◆ release()

bool Qrack::release ( quid  sid,
bitLenInt  q 
)

Release qubit ID.

(External API) Release 1 qubit with the given qubit ID, under the simulator ID

◆ removeIdentities()

void Qrack::removeIdentities ( std::vector< QubitPauliBasis > *  qb)

◆ ResetAll()

void Qrack::ResetAll ( quid  sid)

Set simulator to |0> permutation state.

(External API) Set the simulator to a computational basis permutation.

◆ ResetUnitaryFidelity()

void Qrack::ResetUnitaryFidelity ( quid  sid)

Reset fidelity to 1 for "Schmidt decomposition rounding parameter" (SDRP) and "near-Clifford rounding".

◆ reverse()

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

◆ RevertPauliBasis()

void Qrack::RevertPauliBasis ( QInterfacePtr  simulator,
std::vector< QubitPauliBasis qb 
)

◆ RHelper()

void Qrack::RHelper ( quid  sid,
real1_f  phi,
QubitPauliBasis  qb 
)

◆ rotate()

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

◆ S()

void Qrack::S ( quid  sid,
bitLenInt  q 
)

(External API) "S" Gate

◆ seed()

void Qrack::seed ( quid  sid,
unsigned  s 
)

"Seed" random number generator (if pseudo-random Mersenne twister is in use)

(External API) Set RNG seed for simulator ID

◆ Separate()

void Qrack::Separate ( quid  sid,
std::vector< bitLenInt q 
)

Force (inexact) factorization of qubit subsystem out of "bulk" simulator state.

◆ set_concurrency()

void Qrack::set_concurrency ( quid  sid,
unsigned  p 
)

Set CPU concurrency (if build isn't serial)

(External API) Set concurrency level per QEngine shard

◆ set_qneuron_activation_fn()

void Qrack::set_qneuron_activation_fn ( quid  nid,
QNeuronActivationFn  f 
)

Set the activation function for a quantum neuron.

◆ set_qneuron_alpha()

void Qrack::set_qneuron_alpha ( quid  nid,
real1_f  alpha 
)

Set the "leakage" parameter for "leaky" quantum neuron activation functions.

◆ set_qneuron_angles()

void Qrack::set_qneuron_angles ( quid  nid,
std::vector< real1 angles 
)

Set the (RY-rotation) angle parameters for each permutation of quantum neuron input qubits.

◆ SetNcrp()

void Qrack::SetNcrp ( quid  sid,
double  sdrp 
)

Set "Near-Clifford rounding parameter".

◆ SetNoiseParameter()

void Qrack::SetNoiseParameter ( quid  sid,
double  np 
)

Set noise parameter (for QInterfaceNoisy)

◆ SetPermutation()

void Qrack::SetPermutation ( quid  sid,
bitCapInt  p 
)

Set bit string permutation eigenstate of simulator instance.

◆ SetReactiveSeparate()

void Qrack::SetReactiveSeparate ( quid  sid,
bool  irs 
)

Turn off/on "reactive separation" feature (for less/more aggressive automatic state factorization)

◆ SetSdrp()

void Qrack::SetSdrp ( quid  sid,
double  sdrp 
)

Set "Schmidt decomposition rounding parameter" (SDRP) value (see https://arxiv.org/abs/2304.14969)

◆ SetTInjection()

void Qrack::SetTInjection ( quid  sid,
bool  iti 
)

Turn off/on "T-injection" feature (for "near-Clifford" simulation with RZ gates)

◆ SUB()

void Qrack::SUB ( quid  sid,
bitCapInt  a,
std::vector< bitLenInt q 
)

◆ SUBS()

void Qrack::SUBS ( quid  sid,
bitCapInt  a,
bitLenInt  s,
std::vector< bitLenInt q 
)

◆ SWAP()

void Qrack::SWAP ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2 
)

◆ SwapShardValues()

void Qrack::SwapShardValues ( bitLenInt  v1,
bitLenInt  v2,
std::map< quid, bitLenInt > &  simMap 
)

◆ SX()

void Qrack::SX ( quid  sid,
bitLenInt  q 
)

(External API) Square root of X gate

◆ SY()

void Qrack::SY ( quid  sid,
bitLenInt  q 
)

(External API) Square root of Y gate

◆ T()

void Qrack::T ( quid  sid,
bitLenInt  q 
)

(External API) "T" Gate

◆ ThrowIfQbIdArrayIsBad()

void Qrack::ThrowIfQbIdArrayIsBad ( const std::vector< bitLenInt > &  controls,
const bitLenInt qubitCount,
std::string  message 
)
inline

◆ TransformPauliBasis()

void Qrack::TransformPauliBasis ( QInterfacePtr  simulator,
std::vector< QubitPauliBasis qb 
)

◆ TrySeparate1Qb()

bool Qrack::TrySeparate1Qb ( quid  sid,
bitLenInt  qi1 
)

Try to factorize a single-qubit subsystem out of "bulk" simulator state.

(This can improve efficiency but has no logical effect.)

◆ TrySeparate2Qb()

bool Qrack::TrySeparate2Qb ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2 
)

Try to factorize a two-qubit subsystem out of "bulk" simulator state.

(This can improve efficiency but has no logical effect.)

◆ TrySeparateTol()

bool Qrack::TrySeparateTol ( quid  sid,
std::vector< bitLenInt q,
real1_f  tol 
)

Try to factorize a qubit subsystem out of "bulk" simulator state.

(This can improve efficiency but has no logical effect.)

◆ U()

void Qrack::U ( quid  sid,
bitLenInt  q,
real1_f  theta,
real1_f  phi,
real1_f  lambda 
)

(External API) 3-parameter unitary gate

◆ UCMtrx()

void Qrack::UCMtrx ( quid  sid,
std::vector< bitLenInt c,
std::vector< complex m,
bitLenInt  q,
bitCapIntOcl  p 
)

Multi-controlled gate that activates only for the specified permutation of controls, "p".

(External API) Controlled 2x2 complex matrix unitary gate with arbitrary control permutation

◆ UnitaryExpectation()

real1_f Qrack::UnitaryExpectation ( quid  sid,
std::vector< QubitU3Basis q 
)

Get the single-qubit (3-parameter) operator expectation value for the array of qubits and bases.

(External API) Get the single-qubit (3-parameter) operator expectation value for the array of qubits and bases.

◆ UnitaryExpectationEigenVal()

real1_f Qrack::UnitaryExpectationEigenVal ( quid  sid,
std::vector< QubitU3BasisEigenVal q 
)

Get the single-qubit (3-parameter) operator expectation value for the array of qubits and bases.

(External API) Get the single-qubit (3-parameter) operator expectation value for the array of qubits and bases.

◆ UnitaryExpVar()

real1_f Qrack::UnitaryExpVar ( bool  isExp,
quid  sid,
std::vector< QubitU3Basis q 
)

◆ UnitaryExpVarEigenVal()

real1_f Qrack::UnitaryExpVarEigenVal ( bool  isExp,
quid  sid,
std::vector< QubitU3BasisEigenVal q 
)

◆ UnitaryVariance()

real1_f Qrack::UnitaryVariance ( quid  sid,
std::vector< QubitU3Basis q 
)

Get the single-qubit (3-parameter) operator variance for the array of qubits and bases.

(External API) Get the single-qubit (3-parameter) operator variance for the array of qubits and bases.

◆ UnitaryVarianceEigenVal()

real1_f Qrack::UnitaryVarianceEigenVal ( quid  sid,
std::vector< QubitU3BasisEigenVal q 
)

Get the single-qubit (3-parameter) operator variance for the array of qubits and bases.

(External API) Get the single-qubit (3-parameter) operator variance for the array of qubits and bases.

◆ Variance()

real1_f Qrack::Variance ( quid  sid,
std::vector< bitLenInt q 
)

Variance for bit-string integer equivalent of specified arbitrary group of qubits.

(External API) Get the permutation variance, based upon the order of input qubits.

◆ VarianceRdm()

real1_f Qrack::VarianceRdm ( quid  sid,
std::vector< bitLenInt q,
bool  r 
)

"Reduced density matrix" variance for bit-string integer equivalent of specified arbitrary group of qubits

(External API) Get the permutation variance, based upon the order of input qubits, treating all ancillary qubits as post-selected T gate gadgets.

◆ X()

void Qrack::X ( quid  sid,
bitLenInt  q 
)

(External API) "X" Gate

◆ XNOR()

void Qrack::XNOR ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2,
bitLenInt  qo 
)

◆ XOR()

void Qrack::XOR ( quid  sid,
bitLenInt  qi1,
bitLenInt  qi2,
bitLenInt  qo 
)

◆ Y()

void Qrack::Y ( quid  sid,
bitLenInt  q 
)

(External API) "Y" Gate

◆ Z()

void Qrack::Z ( quid  sid,
bitLenInt  q 
)

(External API) "Z" Gate

Variable Documentation

◆ _qrack_qbdt_sep_thresh

const real1_f Qrack::_qrack_qbdt_sep_thresh = FP_NORM_EPSILON

◆ _qrack_qunit_sep_thresh

const real1_f Qrack::_qrack_qunit_sep_thresh = FP_NORM_EPSILON

◆ bitsInCap

constexpr bitLenInt Qrack::bitsInCap = ((bitLenInt)1U) << ((bitLenInt)QBCAPPOW)
constexpr

◆ C_SQRT1_2

◆ C_SQRT1_2_NEG

QRACK_CONST complex Qrack::C_SQRT1_2_NEG = complex(-SQRT1_2_R1, ZERO_R1)

◆ C_SQRT_I

◆ C_SQRT_N_I

◆ circuitMutexes

std::map<QCircuit*, std::mutex> Qrack::circuitMutexes

◆ circuitReservations

std::vector<bool> Qrack::circuitReservations

◆ circuits

std::vector<QCircuitPtr> Qrack::circuits

◆ CMPLX_DEFAULT_ARG

◆ FIDELITY_MIN

const double Qrack::FIDELITY_MIN = log((double)FP_NORM_EPSILON)

◆ FP_NORM_EPSILON

QRACK_CONST real1 Qrack::FP_NORM_EPSILON = (real1)(std::numeric_limits<real1>::epsilon() / 4)

◆ FP_NORM_EPSILON_F

QRACK_CONST real1_f Qrack::FP_NORM_EPSILON_F = (real1_f)FP_NORM_EPSILON

◆ HALF_I_HALF_CMPLX

QRACK_CONST complex Qrack::HALF_I_HALF_CMPLX = complex(HALF_R1, HALF_R1)

◆ HALF_NEG_I_HALF_CMPLX

QRACK_CONST complex Qrack::HALF_NEG_I_HALF_CMPLX = complex(HALF_R1, -HALF_R1)

◆ HALF_R1

QRACK_CONST real1 Qrack::HALF_R1 = (real1)0.5f

◆ I_CMPLX

◆ I_CMPLX_NEG

QRACK_CONST complex Qrack::I_CMPLX_NEG = complex(ZERO_R1, -ONE_R1)

◆ metaOperationMutex

std::mutex Qrack::metaOperationMutex

◆ neuronErrors

std::vector<int> Qrack::neuronErrors

◆ neuronMutexes

std::map<QNeuron*, std::mutex> Qrack::neuronMutexes

◆ neuronReservations

std::vector<bool> Qrack::neuronReservations

◆ neurons

std::vector<QNeuronPtr> Qrack::neurons

◆ neuronSimulators

std::map<QNeuronPtr, QInterface*> Qrack::neuronSimulators

◆ ONE_BCI

const bitCapInt Qrack::ONE_BCI = 1U

◆ ONE_CMPLX

QRACK_CONST complex Qrack::ONE_CMPLX = complex(ONE_R1, ZERO_R1)

◆ ONE_R1

QRACK_CONST real1 Qrack::ONE_R1 = (real1)1.0f

◆ PI_R1

QRACK_CONST real1 Qrack::PI_R1 = (real1)M_PI

◆ PSTRIDEPOW_DEFAULT

const bitLenInt Qrack::PSTRIDEPOW_DEFAULT = PSTRIDEPOW

◆ QRACK_MAX_CPU_QB_DEFAULT

const bitLenInt Qrack::QRACK_MAX_CPU_QB_DEFAULT = -1

◆ QRACK_MAX_PAGE_QB_DEFAULT

const bitLenInt Qrack::QRACK_MAX_PAGE_QB_DEFAULT = QRACK_MAX_CPU_QB_DEFAULT

◆ QRACK_MAX_PAGING_QB_DEFAULT

const bitLenInt Qrack::QRACK_MAX_PAGING_QB_DEFAULT = QRACK_MAX_CPU_QB_DEFAULT

◆ QRACK_QRACK_QTENSORNETWORK_THRESHOLD_CPU_QB

const bitLenInt Qrack::QRACK_QRACK_QTENSORNETWORK_THRESHOLD_CPU_QB = 32U

◆ randNumGen

qrack_rand_gen_ptr Qrack::randNumGen = std::make_shared<qrack_rand_gen>(time(0))

◆ REAL1_EPSILON

QRACK_CONST real1 Qrack::REAL1_EPSILON = (real1)0.000000477f

◆ shards

std::map<QInterface*, std::map<quid, bitLenInt> > Qrack::shards

◆ SIGNMASK [1/2]

const __m256d Qrack::SIGNMASK = _mm256_set_pd(-0.0, -0.0, -0.0, -0.0)
static

◆ SIGNMASK [2/2]

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

◆ simulatorHostPointer

std::vector<bool> Qrack::simulatorHostPointer

◆ simulatorMutexes

std::map<QInterface*, std::mutex> Qrack::simulatorMutexes

◆ simulatorReservations

std::vector<bool> Qrack::simulatorReservations

◆ simulators

std::vector<QInterfacePtr> Qrack::simulators

◆ simulatorTypes

std::vector<std::vector<QInterfaceEngine> > Qrack::simulatorTypes

◆ SQRT1_2_R1

QRACK_CONST real1 Qrack::SQRT1_2_R1 = (real1)M_SQRT1_2

◆ SQRT2_R1

QRACK_CONST real1 Qrack::SQRT2_R1 = (real1)M_SQRT2

◆ TRYDECOMPOSE_EPSILON

QRACK_CONST real1_f Qrack::TRYDECOMPOSE_EPSILON = 32 * FP_NORM_EPSILON_F

◆ ZERO_BCI

const bitCapInt Qrack::ZERO_BCI = 0U

◆ ZERO_CMPLX

QRACK_CONST complex Qrack::ZERO_CMPLX = complex(ZERO_R1, ZERO_R1)

◆ ZERO_R1

QRACK_CONST real1 Qrack::ZERO_R1 = (real1)0.0f