Qrack  10.0
General classical-emulating-quantum development framework
qpager.hpp
Go to the documentation of this file.
1 //
3 // (C) Daniel Strano and the Qrack contributors 2017-2023. All rights reserved.
4 //
5 // This is a multithreaded, universal quantum register simulation, allowing
6 // (nonphysical) register cloning and direct measurement of probability and
7 // phase, to leverage what advantages classical emulation of qubits can have.
8 //
9 // Licensed under the GNU Lesser General Public License V3.
10 // See LICENSE.md in the project root or https://www.gnu.org/licenses/lgpl-3.0.en.html
11 // for details.
12 #pragma once
13 
14 #include "qengine.hpp"
15 #if ENABLE_OPENCL
16 #include "common/oclengine.hpp"
17 #endif
18 #if ENABLE_CUDA
19 #include "common/cudaengine.cuh"
20 #endif
21 
22 namespace Qrack {
23 
24 class QPager;
25 typedef std::shared_ptr<QPager> QPagerPtr;
26 
31 class QPager : public QEngine, public std::enable_shared_from_this<QPager> {
32 protected:
34  bool isSparse;
35  bool useTGadget;
40  int64_t devID;
45  std::vector<bool> devicesHostPointer;
46  std::vector<int64_t> deviceIDs;
47  std::vector<QInterfaceEngine> engines;
48  std::vector<QEnginePtr> qPages;
49 
51 
53  {
58  }
59 
61  {
62  bitCapInt toRet;
63  bi_div_mod_small(maxQPower, qPages.size(), &toRet, nullptr);
64  return (bitCapIntOcl)toRet;
65  }
66  bitLenInt pagedQubitCount() { return log2Ocl(qPages.size()); }
68  int64_t GetPageDevice(bitCapIntOcl page) { return deviceIDs[page % deviceIDs.size()]; }
70 
71  void CombineEngines(bitLenInt thresholdBits);
73  void SeparateEngines(bitLenInt thresholdBits, bool noBaseFloor = false);
75 
76  template <typename Qubit1Fn>
77  void SingleBitGate(bitLenInt target, Qubit1Fn fn, bool isSqiCtrl = false, bool isAnti = false);
78  template <typename Qubit1Fn>
79  void MetaControlled(const bitCapInt& controlPerm, const std::vector<bitLenInt>& controls, bitLenInt target,
80  Qubit1Fn fn, const complex* mtrx, bool isSqiCtrl = false, bool isIntraCtrled = false);
81  template <typename Qubit1Fn>
82  void SemiMetaControlled(
83  const bitCapInt& controlPerm, std::vector<bitLenInt> controls, bitLenInt target, Qubit1Fn fn);
84  void MetaSwap(bitLenInt qubit1, bitLenInt qubit2, bool isIPhaseFac, bool isInverse);
85 
86  template <typename F> void CombineAndOp(F fn, std::vector<bitLenInt> bits);
87  template <typename F>
88  void CombineAndOpControlled(F fn, std::vector<bitLenInt> bits, const std::vector<bitLenInt>& controls);
89 
90  void ApplySingleEither(bool isInvert, const complex& top, const complex& bottom, bitLenInt target);
92  const bitCapInt& controlPerm, const std::vector<bitLenInt>& controls, bitLenInt target, const complex* mtrx);
93  void EitherISwap(bitLenInt qubit1, bitLenInt qubit2, bool isInverse);
94 
95  void Init();
96 
97  void GetSetAmplitudePage(complex* pagePtr, const complex* cPagePtr, bitCapIntOcl offset, bitCapIntOcl length);
98 
99  real1_f ExpVarBitsAll(bool isExp, const std::vector<bitLenInt>& bits, const bitCapInt& offset = ZERO_BCI);
100 
101  using QEngine::Copy;
102  void Copy(QInterfacePtr orig) { Copy(std::dynamic_pointer_cast<QPager>(orig)); }
103  void Copy(QPagerPtr orig)
104  {
105  QEngine::Copy(std::dynamic_pointer_cast<QEngine>(orig));
106  useGpuThreshold = orig->useGpuThreshold;
107  isSparse = orig->isSparse;
108  useTGadget = orig->useTGadget;
109  maxPageSetting = orig->maxPageSetting;
110  maxPageQubits = orig->maxPageQubits;
111  thresholdQubitsPerPage = orig->thresholdQubitsPerPage;
112  baseQubitsPerPage = orig->baseQubitsPerPage;
113  devID = orig->devID;
114  rootEngine = orig->rootEngine;
115  basePageMaxQPower = orig->basePageMaxQPower;
116  basePageCount = orig->basePageCount;
117  phaseFactor = orig->phaseFactor;
118  devicesHostPointer = orig->devicesHostPointer;
119  deviceIDs = orig->deviceIDs;
120  engines = orig->engines;
121  qPages = orig->qPages;
122  }
123 
124 public:
125  QPager(std::vector<QInterfaceEngine> eng, bitLenInt qBitCount, const bitCapInt& initState = ZERO_BCI,
126  qrack_rand_gen_ptr rgp = nullptr, const complex& phaseFac = CMPLX_DEFAULT_ARG, bool doNorm = false,
127  bool ignored = false, bool useHostMem = false, int64_t deviceId = -1, bool useHardwareRNG = true,
128  bool useSparseStateVec = false, real1_f norm_thresh = REAL1_EPSILON, std::vector<int64_t> devList = {},
129  bitLenInt qubitThreshold = 0U, real1_f separation_thresh = _qrack_qunit_sep_thresh);
130 
131  QPager(bitLenInt qBitCount, const bitCapInt& initState = ZERO_BCI, qrack_rand_gen_ptr rgp = nullptr,
132  const complex& phaseFac = CMPLX_DEFAULT_ARG, bool doNorm = false, bool ignored = false, bool useHostMem = false,
133  int64_t deviceId = -1, bool useHardwareRNG = true, bool useSparseStateVec = false,
134  real1_f norm_thresh = REAL1_EPSILON, std::vector<int64_t> devList = {}, bitLenInt qubitThreshold = 0U,
135  real1_f separation_thresh = _qrack_qunit_sep_thresh)
136 #if ENABLE_OPENCL
137  : QPager({ OCLEngine::Instance().GetDeviceCount() ? QINTERFACE_OPENCL : QINTERFACE_CPU }, qBitCount, initState,
138  rgp, phaseFac, doNorm, ignored, useHostMem, deviceId, useHardwareRNG, useSparseStateVec, norm_thresh,
139  devList, qubitThreshold, separation_thresh)
140 #elif ENABLE_CUDA
141  : QPager({ CUDAEngine::Instance().GetDeviceCount() ? QINTERFACE_CUDA : QINTERFACE_CPU }, qBitCount, initState,
142  rgp, phaseFac, doNorm, ignored, useHostMem, deviceId, useHardwareRNG, useSparseStateVec, norm_thresh,
143  devList, qubitThreshold, separation_thresh)
144 #else
145  : QPager({ QINTERFACE_CPU }, qBitCount, initState, rgp, phaseFac, doNorm, ignored, useHostMem, deviceId,
146  useHardwareRNG, useSparseStateVec, norm_thresh, devList, qubitThreshold, separation_thresh)
147 #endif
148  {
149  }
150 
151  QPager(QEnginePtr enginePtr, std::vector<QInterfaceEngine> eng, bitLenInt qBitCount,
152  const bitCapInt& ignored = ZERO_BCI, qrack_rand_gen_ptr rgp = nullptr,
153  const complex& phaseFac = CMPLX_DEFAULT_ARG, bool doNorm = false, bool ignored2 = false,
154  bool useHostMem = false, int64_t deviceId = -1, bool useHardwareRNG = true, bool useSparseStateVec = false,
155  real1_f norm_thresh = REAL1_EPSILON, std::vector<int64_t> devList = {}, bitLenInt qubitThreshold = 0U,
156  real1_f separation_thresh = _qrack_qunit_sep_thresh);
157 
158  void SetConcurrency(uint32_t threadsPerEngine)
159  {
160  QInterface::SetConcurrency(threadsPerEngine);
161  for (QEnginePtr& qPage : qPages) {
162  qPage->SetConcurrency(threadsPerEngine);
163  }
164  }
165  void SetTInjection(bool useGadget)
166  {
167  useTGadget = useGadget;
168  for (QEnginePtr& qPage : qPages) {
169  qPage->SetTInjection(useTGadget);
170  }
171  }
172  bool GetTInjection() { return useTGadget; }
173  bool isOpenCL() { return qPages[0U]->isOpenCL(); }
174 
176  {
177  CombineEngines();
178  return qPages[0U];
179  }
180 
182  {
183  qPages.resize(1U);
184  qPages[0U] = eng;
185  eng->SetDevice(deviceIDs[0]);
186  SeparateEngines();
187  }
188 
190  {
191  for (QEnginePtr& qPage : qPages) {
192  qPage->ZeroAmplitudes();
193  }
194  }
195  void CopyStateVec(QEnginePtr src) { CopyStateVec(std::dynamic_pointer_cast<QPager>(src)); }
197  {
198  bitLenInt qpp = qubitsPerPage();
199  src->CombineEngines(qpp);
200  src->SeparateEngines(qpp, true);
201 
202  for (size_t i = 0U; i < qPages.size(); ++i) {
203  qPages[i]->CopyStateVec(src->qPages[i]);
204  }
205  }
207  {
208  for (size_t i = 0U; i < qPages.size(); ++i) {
209  if (!qPages[i]->IsZeroAmplitude()) {
210  return false;
211  }
212  }
213 
214  return true;
215  }
216  void GetAmplitudePage(complex* pagePtr, bitCapIntOcl offset, bitCapIntOcl length)
217  {
218  GetSetAmplitudePage(pagePtr, nullptr, offset, length);
219  }
220  void SetAmplitudePage(const complex* pagePtr, bitCapIntOcl offset, bitCapIntOcl length)
221  {
222  GetSetAmplitudePage(nullptr, pagePtr, offset, length);
223  }
224  void SetAmplitudePage(QEnginePtr pageEnginePtr, bitCapIntOcl srcOffset, bitCapIntOcl dstOffset, bitCapIntOcl length)
225  {
226  SetAmplitudePage(std::dynamic_pointer_cast<QPager>(pageEnginePtr), srcOffset, dstOffset, length);
227  }
228  void SetAmplitudePage(QPagerPtr pageEnginePtr, bitCapIntOcl srcOffset, bitCapIntOcl dstOffset, bitCapIntOcl length)
229  {
230  CombineEngines();
231  pageEnginePtr->CombineEngines();
232  qPages[0U]->SetAmplitudePage(pageEnginePtr->qPages[0U], srcOffset, dstOffset, length);
233  }
234  void ShuffleBuffers(QEnginePtr engine) { ShuffleBuffers(std::dynamic_pointer_cast<QPager>(engine)); }
236  {
237  bitLenInt qpp = qubitsPerPage();
238  bitLenInt tcqpp = engine->qubitsPerPage();
239  engine->SeparateEngines(qpp, true);
240  SeparateEngines(tcqpp, true);
241 
242  if (qPages.size() == 1U) {
243  return qPages[0U]->ShuffleBuffers(engine->qPages[0U]);
244  }
245 
246  const size_t offset = qPages.size() >> 1U;
247  for (size_t i = 0U; i < offset; ++i) {
248  qPages[offset + i].swap(engine->qPages[i]);
249  }
250  }
252  void QueueSetDoNormalize(bool doNorm)
253  {
254  Finish();
255  doNormalize = doNorm;
256  }
257  void QueueSetRunningNorm(real1_f runningNrm)
258  {
259  Finish();
260  runningNorm = runningNrm;
261  }
262  real1_f ProbReg(bitLenInt start, bitLenInt length, const bitCapInt& permutation)
263  {
264  CombineEngines();
265  return qPages[0U]->ProbReg(start, length, permutation);
266  }
267  using QEngine::ApplyM;
268  void ApplyM(const bitCapInt& regMask, const bitCapInt& result, const complex& nrm)
269  {
270  CombineEngines();
271  return qPages[0U]->ApplyM(regMask, result, nrm);
272  }
273  real1_f GetExpectation(bitLenInt valueStart, bitLenInt valueLength)
274  {
275  CombineEngines();
276  return qPages[0U]->GetExpectation(valueStart, valueLength);
277  }
278  void Apply2x2(bitCapIntOcl offset1, bitCapIntOcl offset2, const complex* mtrx, bitLenInt bitCount,
279  const bitCapIntOcl* qPowersSorted, bool doCalcNorm, real1_f norm_thresh = REAL1_DEFAULT_ARG)
280  {
281  CombineEngines();
282  qPages[0U]->Apply2x2(offset1, offset2, mtrx, bitCount, qPowersSorted, doCalcNorm, norm_thresh);
283  }
285  {
286  real1_f toRet = ZERO_R1_F;
287  for (QEnginePtr& qPage : qPages) {
288  toRet += qPage->GetRunningNorm();
289  }
290 
291  return toRet;
292  }
293 
295  {
296  for (size_t i = 0U; i < qPages.size(); ++i) {
297  if (!qPages[i]->IsZeroAmplitude()) {
298  return qPages[i]->FirstNonzeroPhase();
299  }
300  }
301 
302  return ZERO_R1_F;
303  }
304 
305  void SetQuantumState(const complex* inputState);
306  void GetQuantumState(complex* outputState);
307  void GetProbs(real1* outputProbs);
309  {
310  bitCapInt p, a;
311  bi_div_mod(perm, pageMaxQPower(), &p, &a);
312  return qPages[(bitCapIntOcl)p]->GetAmplitude(a);
313  }
314  void SetAmplitude(const bitCapInt& perm, const complex& amp)
315  {
316  bitCapInt p, a;
317  bi_div_mod(perm, pageMaxQPower(), &p, &a);
318  qPages[(bitCapIntOcl)p]->SetAmplitude(a, amp);
319  }
320  real1_f ProbAll(const bitCapInt& perm)
321  {
322  bitCapInt p, a;
323  bi_div_mod(perm, pageMaxQPower(), &p, &a);
324  return qPages[(bitCapIntOcl)p]->ProbAll(a);
325  }
327 
328  void SetPermutation(const bitCapInt& perm, const complex& phaseFac = CMPLX_DEFAULT_ARG);
329 
330  using QEngine::Compose;
331  bitLenInt Compose(QPagerPtr toCopy) { return ComposeEither(toCopy, false); }
332  bitLenInt Compose(QInterfacePtr toCopy) { return Compose(std::dynamic_pointer_cast<QPager>(toCopy)); }
333  bitLenInt ComposeNoClone(QPagerPtr toCopy) { return ComposeEither(toCopy, true); }
334  bitLenInt ComposeNoClone(QInterfacePtr toCopy) { return ComposeNoClone(std::dynamic_pointer_cast<QPager>(toCopy)); }
335  bitLenInt ComposeEither(QPagerPtr toCopy, bool willDestroy);
336  void Decompose(bitLenInt start, QInterfacePtr dest) { Decompose(start, std::dynamic_pointer_cast<QPager>(dest)); }
337  void Decompose(bitLenInt start, QPagerPtr dest);
339  void Dispose(bitLenInt start, bitLenInt length);
340  void Dispose(bitLenInt start, bitLenInt length, const bitCapInt& disposedPerm);
341  using QEngine::Allocate;
342  bitLenInt Allocate(bitLenInt start, bitLenInt length);
343 
344  void Mtrx(const complex* mtrx, bitLenInt target);
345  void Phase(const complex& topLeft, const complex& bottomRight, bitLenInt qubitIndex)
346  {
347  ApplySingleEither(false, topLeft, bottomRight, qubitIndex);
348  }
349  void Invert(const complex& topRight, const complex& bottomLeft, bitLenInt qubitIndex)
350  {
351  ApplySingleEither(true, topRight, bottomLeft, qubitIndex);
352  }
353  void MCMtrx(const std::vector<bitLenInt>& controls, const complex* mtrx, bitLenInt target)
354  {
355  if (qPages.size() == 1U) {
356  return qPages[0U]->MCMtrx(controls, mtrx, target);
357  }
358  bitCapInt p = pow2(controls.size());
359  bi_decrement(&p, 1U);
360  ApplyEitherControlledSingleBit(p, controls, target, mtrx);
361  }
362  void MACMtrx(const std::vector<bitLenInt>& controls, const complex* mtrx, bitLenInt target)
363  {
364  if (qPages.size() == 1U) {
365  return qPages[0U]->MACMtrx(controls, mtrx, target);
366  }
367  ApplyEitherControlledSingleBit(ZERO_BCI, controls, target, mtrx);
368  }
369 
370  void UniformParityRZ(const bitCapInt& mask, real1_f angle);
371  void CUniformParityRZ(const std::vector<bitLenInt>& controls, const bitCapInt& mask, real1_f angle);
372 
373  void XMask(const bitCapInt& mask);
374  void ZMask(const bitCapInt& mask) { PhaseParity(PI_R1, mask); }
375  void PhaseParity(real1_f radians, const bitCapInt& mask);
376 
377  bool ForceM(bitLenInt qubit, bool result, bool doForce = true, bool doApply = true);
379  bitLenInt start, bitLenInt length, const bitCapInt& result, bool doForce = true, bool doApply = true)
380  {
381  // Don't use QEngine::ForceMReg().
382  return QInterface::ForceMReg(start, length, result, doForce, doApply);
383  }
384 
385 #if ENABLE_ALU
386  void INCDECSC(
387  const bitCapInt& toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex, bitLenInt carryIndex);
388  void INCDECSC(const bitCapInt& toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
389 #if ENABLE_BCD
390  void INCBCD(const bitCapInt& toAdd, bitLenInt start, bitLenInt length);
391  void INCDECBCDC(const bitCapInt& toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
392 #endif
393  void MUL(const bitCapInt& toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length);
394  void DIV(const bitCapInt& toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length);
395  void MULModNOut(
396  const bitCapInt& toMul, const bitCapInt& modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length);
397  void IMULModNOut(
398  const bitCapInt& toMul, const bitCapInt& modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length);
399  void POWModNOut(
400  const bitCapInt& base, const bitCapInt& modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length);
401  void CMUL(const bitCapInt& toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length,
402  const std::vector<bitLenInt>& controls);
403  void CDIV(const bitCapInt& toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length,
404  const std::vector<bitLenInt>& controls);
405  void CMULModNOut(const bitCapInt& toMul, const bitCapInt& modN, bitLenInt inStart, bitLenInt outStart,
406  bitLenInt length, const std::vector<bitLenInt>& controls);
407  void CIMULModNOut(const bitCapInt& toMul, const bitCapInt& modN, bitLenInt inStart, bitLenInt outStart,
408  bitLenInt length, const std::vector<bitLenInt>& controls);
409  void CPOWModNOut(const bitCapInt& base, const bitCapInt& modN, bitLenInt inStart, bitLenInt outStart,
410  bitLenInt length, const std::vector<bitLenInt>& controls);
411 
412  bitCapInt IndexedLDA(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength,
413  const unsigned char* values, bool resetValue = true);
414  bitCapInt IndexedADC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength,
415  bitLenInt carryIndex, const unsigned char* values);
416  bitCapInt IndexedSBC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength,
417  bitLenInt carryIndex, const unsigned char* values);
418  void Hash(bitLenInt start, bitLenInt length, const unsigned char* values);
419 
420  void CPhaseFlipIfLess(const bitCapInt& greaterPerm, bitLenInt start, bitLenInt length, bitLenInt flagIndex);
421  void PhaseFlipIfLess(const bitCapInt& greaterPerm, bitLenInt start, bitLenInt length);
422 #endif
423 
424  void Swap(bitLenInt qubitIndex1, bitLenInt qubitIndex2);
425  void ISwap(bitLenInt qubit1, bitLenInt qubit2) { EitherISwap(qubit1, qubit2, false); }
426  void IISwap(bitLenInt qubit1, bitLenInt qubit2) { EitherISwap(qubit1, qubit2, true); }
427  void FSim(real1_f theta, real1_f phi, bitLenInt qubitIndex1, bitLenInt qubitIndex2);
428 
429  real1_f Prob(bitLenInt qubitIndex);
430  real1_f ProbMask(const bitCapInt& mask, const bitCapInt& permutation);
431  // TODO: QPager not yet used in Q#, but this would need a real implementation:
433  {
434  if (bi_compare_0(mask) == 0) {
435  return ZERO_R1_F;
436  }
437 
438  CombineEngines();
439  return qPages[0U]->ProbParity(mask);
440  }
441  bool ForceMParity(const bitCapInt& mask, bool result, bool doForce = true)
442  {
443  if (bi_compare_0(mask) == 0) {
444  return ZERO_R1_F;
445  }
446 
447  CombineEngines();
448  return qPages[0U]->ForceMParity(mask, result, doForce);
449  }
450 
451  void UpdateRunningNorm(real1_f norm_thresh = REAL1_DEFAULT_ARG);
452  void NormalizeState(
453  real1_f nrm = REAL1_DEFAULT_ARG, real1_f norm_thresh = REAL1_DEFAULT_ARG, real1_f phaseArg = ZERO_R1_F);
454 
455  void Finish()
456  {
457  for (QEnginePtr& qPage : qPages) {
458  qPage->Finish();
459  }
460  };
461 
462  bool isFinished()
463  {
464  for (QEnginePtr& qPage : qPages) {
465  if (!qPage->isFinished()) {
466  return false;
467  }
468  }
469 
470  return true;
471  };
472 
473  void Dump()
474  {
475  for (QEnginePtr& qPage : qPages) {
476  qPage->Dump();
477  }
478  };
479 
482 
483  void SetDevice(int64_t dID)
484  {
485  devID = dID;
486  SetDeviceList(std::vector<int64_t>{ dID });
487  }
488 
489  void SetDeviceList(std::vector<int64_t> dIDs)
490  {
491  deviceIDs = dIDs;
492 
493  for (size_t i = 0U; i < qPages.size(); ++i) {
494  qPages[i]->SetDevice(deviceIDs[i % deviceIDs.size()]);
495  }
496 
497 #if ENABLE_OPENCL || ENABLE_CUDA
498  if (rootEngine != QINTERFACE_CPU) {
499 #if ENABLE_OPENCL
500  maxPageQubits =
501  log2Ocl(OCLEngine::Instance().GetDeviceContextPtr(devID)->GetMaxAlloc() / sizeof(complex)) - 1U;
502 #else
503  maxPageQubits =
504  log2Ocl(CUDAEngine::Instance().GetDeviceContextPtr(devID)->GetMaxAlloc() / sizeof(complex)) - 1U;
505 #endif
508  }
509  }
510 
511  if (!useGpuThreshold) {
512  return;
513  }
514 
515  // Limit at the power of 2 less-than-or-equal-to a full max memory allocation segment, or choose with
516  // environment variable.
518 #endif
519  }
520 
521  int64_t GetDevice() { return devID; }
522  std::vector<int64_t> GetDeviceList() { return deviceIDs; }
523 
524  bitCapIntOcl GetMaxSize() { return qPages[0U]->GetMaxSize(); };
525 
526  real1_f SumSqrDiff(QInterfacePtr toCompare) { return SumSqrDiff(std::dynamic_pointer_cast<QPager>(toCompare)); }
527 
528  real1_f SumSqrDiff(QPagerPtr toCompare);
529 };
530 } // namespace Qrack
void bi_decrement(BigInteger *pBigInt, const BIG_INTEGER_WORD &value)
Definition: big_integer.hpp:237
void bi_div_mod_small(const BigInteger &left, BIG_INTEGER_HALF_WORD right, BigInteger *quotient, BIG_INTEGER_HALF_WORD *rmndr)
"Schoolbook division" (on half words) Complexity - O(x^2)
Definition: big_integer.cpp:182
int bi_compare_0(const BigInteger &left)
Definition: big_integer.hpp:140
void bi_div_mod(const BigInteger &left, const BigInteger &right, BigInteger *quotient, BigInteger *rmndr)
Adapted from Qrack! (The fundamental algorithm was discovered before.) Complexity - O(log)
Definition: big_integer.cpp:221
int GetDeviceCount()
Get the count of devices in the current list.
Definition: oclengine.hpp:316
static OCLEngine & Instance()
Get a pointer to the Instance of the singleton. (The instance will be instantiated,...
Definition: oclengine.hpp:270
Abstract QEngine implementation, for all "Schroedinger method" engines.
Definition: qengine.hpp:31
virtual void Copy(QInterfacePtr orig)
Copy this QInterface.
Definition: qinterface.hpp:222
virtual void ApplyM(const bitCapInt &qPower, bool result, const complex &nrm)
Definition: qengine.hpp:167
real1 runningNorm
The value stored in runningNorm should always be the total probability implied by the norm of all amp...
Definition: qengine.hpp:39
virtual void Decompose(bitLenInt start, QInterfacePtr dest)=0
Minimally decompose a set of contiguous bits from the separably composed unit, into "destination".
virtual void FSim(real1_f theta, real1_f phi, bitLenInt qubit1, bitLenInt qubit2)
The 2-qubit "fSim" gate, (useful in the simulation of particles with fermionic statistics)
Definition: qinterface.hpp:2389
virtual void Swap(bitLenInt qubit1, bitLenInt qubit2)
Swap values of two bits in register.
Definition: gates.cpp:166
bitCapInt maxQPower
Definition: qinterface.hpp:149
virtual void SetConcurrency(uint32_t threadsPerEngine)
Set the number of threads in parallel for loops, per component QEngine.
Definition: qinterface.hpp:275
virtual bitLenInt Allocate(bitLenInt length)
Allocate new "length" count of |0> state qubits at end of qubit index position.
Definition: qinterface.hpp:477
virtual bitLenInt Compose(QInterfacePtr toCopy)
Combine another QInterface with this one, after the last bit index of this one.
Definition: qinterface.hpp:371
virtual void SetQubitCount(bitLenInt qb)
Definition: qinterface.hpp:268
bitLenInt qubitCount
Definition: qinterface.hpp:146
bool doNormalize
Definition: qinterface.hpp:143
A "Qrack::QPager" splits a "Qrack::QEngine" implementation into equal-length "pages....
Definition: qpager.hpp:31
void SetQubitCount(bitLenInt qb)
Definition: qpager.hpp:52
QInterfacePtr Clone()
Clone this QInterface.
Definition: qpager.cpp:1618
void GetProbs(real1 *outputProbs)
Get the pure quantum state representation.
Definition: qpager.cpp:884
void CombineAndOp(F fn, std::vector< bitLenInt > bits)
Definition: qpager.cpp:595
void Dump()
If asynchronous work is still running, let the simulator know that it can be aborted.
Definition: qpager.hpp:473
bitCapInt HighestProbAll()
Get highest probability permutation.
Definition: qpager.cpp:918
void MULModNOut(const bitCapInt &toMul, const bitCapInt &modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length)
Multiplication modulo N by integer, (out of place)
Definition: qpager.cpp:1203
bitCapInt IndexedADC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, bitLenInt carryIndex, const unsigned char *values)
Add to entangled 8 bit register state with a superposed index-offset-based read from classical memory...
Definition: qpager.cpp:1284
void PhaseFlipIfLess(const bitCapInt &greaterPerm, bitLenInt start, bitLenInt length)
This is an expedient for an adaptive Grover's search for a function's global minimum.
Definition: qpager.cpp:1307
void CombineEngines()
Definition: qpager.hpp:72
bool isFinished()
Returns "false" if asynchronous work is still running, and "true" if all previously dispatched asynch...
Definition: qpager.hpp:462
QInterfacePtr Copy()
Copy this QInterface.
Definition: qpager.cpp:1642
bitCapIntOcl GetMaxSize()
Definition: qpager.hpp:524
void CPhaseFlipIfLess(const bitCapInt &greaterPerm, bitLenInt start, bitLenInt length, bitLenInt flagIndex)
The 6502 uses its carry flag also as a greater-than/less-than flag, for the CMP operation.
Definition: qpager.cpp:1302
bitLenInt pagedQubitCount()
Definition: qpager.hpp:66
bitCapIntOcl basePageMaxQPower
Definition: qpager.hpp:42
real1_f ProbParity(const bitCapInt &mask)
Overall probability of any odd permutation of the masked set of bits.
Definition: qpager.hpp:432
real1_f ProbAll(const bitCapInt &perm)
Direct measure of full permutation probability.
Definition: qpager.hpp:320
bitLenInt thresholdQubitsPerPage
Definition: qpager.hpp:38
QPager(bitLenInt qBitCount, const bitCapInt &initState=ZERO_BCI, qrack_rand_gen_ptr rgp=nullptr, const complex &phaseFac=CMPLX_DEFAULT_ARG, bool doNorm=false, bool ignored=false, bool useHostMem=false, int64_t deviceId=-1, bool useHardwareRNG=true, bool useSparseStateVec=false, real1_f norm_thresh=REAL1_EPSILON, std::vector< int64_t > devList={}, bitLenInt qubitThreshold=0U, real1_f separation_thresh=_qrack_qunit_sep_thresh)
Definition: qpager.hpp:131
void MACMtrx(const std::vector< bitLenInt > &controls, const complex *mtrx, bitLenInt target)
Apply an arbitrary single bit unitary transformation, with arbitrary (anti-)control bits.
Definition: qpager.hpp:362
void DIV(const bitCapInt &toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length)
Divide by integer.
Definition: qpager.cpp:1198
void NormalizeState(real1_f nrm=REAL1_DEFAULT_ARG, real1_f norm_thresh=REAL1_DEFAULT_ARG, real1_f phaseArg=ZERO_R1_F)
Apply the normalization factor found by UpdateRunningNorm() or on the fly by a single bit gate.
Definition: qpager.cpp:1601
void CopyStateVec(QPagerPtr src)
Definition: qpager.hpp:196
void Init()
Definition: qpager.cpp:89
void Mtrx(const complex *mtrx, bitLenInt target)
Apply an arbitrary single bit unitary transformation.
Definition: qpager.cpp:954
real1_f ProbMask(const bitCapInt &mask, const bitCapInt &permutation)
Direct measure of masked permutation probability.
Definition: qpager.cpp:1538
void CPOWModNOut(const bitCapInt &base, const bitCapInt &modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Controlled, raise a classical base to a quantum power, modulo N, (out of place)
Definition: qpager.cpp:1265
void MUL(const bitCapInt &toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length)
Multiply by integer.
Definition: qpager.cpp:1193
real1_f ProbReg(bitLenInt start, bitLenInt length, const bitCapInt &permutation)
Direct measure of register permutation probability.
Definition: qpager.hpp:262
bitCapIntOcl pageMaxQPower()
Definition: qpager.hpp:60
void SemiMetaControlled(const bitCapInt &controlPerm, std::vector< bitLenInt > controls, bitLenInt target, Qubit1Fn fn)
Definition: qpager.cpp:563
void Dispose(bitLenInt start, bitLenInt length)
Minimally decompose a set of contiguous bits from the separably composed unit, and discard the separa...
Definition: qpager.cpp:755
void SetAmplitude(const bitCapInt &perm, const complex &amp)
Sets the representational amplitude of a full permutation.
Definition: qpager.hpp:314
bitCapIntOcl basePageCount
Definition: qpager.hpp:43
void XMask(const bitCapInt &mask)
Masked X gate.
Definition: qpager.cpp:1070
void ApplyEitherControlledSingleBit(const bitCapInt &controlPerm, const std::vector< bitLenInt > &controls, bitLenInt target, const complex *mtrx)
Definition: qpager.cpp:1011
void SetQuantumState(const complex *inputState)
Set an arbitrary pure quantum state representation.
Definition: qpager.cpp:810
void QueueSetDoNormalize(bool doNorm)
Add an operation to the (OpenCL) queue, to set the value of doNormalize, which controls whether to au...
Definition: qpager.hpp:252
void CMUL(const bitCapInt &toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Controlled multiplication by integer.
Definition: qpager.cpp:1221
void SetAmplitudePage(QPagerPtr pageEnginePtr, bitCapIntOcl srcOffset, bitCapIntOcl dstOffset, bitCapIntOcl length)
Definition: qpager.hpp:228
void SetAmplitudePage(const complex *pagePtr, bitCapIntOcl offset, bitCapIntOcl length)
Copy a "page" of amplitudes from pagePtr into this QEngine's internal state.
Definition: qpager.hpp:220
void ShuffleBuffers(QPagerPtr engine)
Definition: qpager.hpp:235
void GetSetAmplitudePage(complex *pagePtr, const complex *cPagePtr, bitCapIntOcl offset, bitCapIntOcl length)
Definition: qpager.cpp:294
bool ForceMParity(const bitCapInt &mask, bool result, bool doForce=true)
Act as if is a measurement of parity of the masked set of qubits was applied, except force the (usual...
Definition: qpager.hpp:441
real1_f GetExpectation(bitLenInt valueStart, bitLenInt valueLength)
Definition: qpager.hpp:273
void EitherISwap(bitLenInt qubit1, bitLenInt qubit2, bool isInverse)
Definition: qpager.cpp:1377
void GetQuantumState(complex *outputState)
Get the pure quantum state representation.
Definition: qpager.cpp:850
void Apply2x2(bitCapIntOcl offset1, bitCapIntOcl offset2, const complex *mtrx, bitLenInt bitCount, const bitCapIntOcl *qPowersSorted, bool doCalcNorm, real1_f norm_thresh=REAL1_DEFAULT_ARG)
Definition: qpager.hpp:278
real1_f FirstNonzeroPhase()
Get phase of lowest permutation nonzero amplitude.
Definition: qpager.hpp:294
bool isSparse
Definition: qpager.hpp:34
void SetTInjection(bool useGadget)
Set the option to use T-injection gadgets (off by default)
Definition: qpager.hpp:165
void INCDECSC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex, bitLenInt carryIndex)
Common driver method behind INCSC and DECSC (with overflow flag)
Definition: qpager.cpp:1170
void UniformParityRZ(const bitCapInt &mask, real1_f angle)
If the target qubit set parity is odd, this applies a phase factor of .
Definition: qpager.cpp:1059
void MCMtrx(const std::vector< bitLenInt > &controls, const complex *mtrx, bitLenInt target)
Apply an arbitrary single bit unitary transformation, with arbitrary control bits.
Definition: qpager.hpp:353
bitCapInt IndexedLDA(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, const unsigned char *values, bool resetValue=true)
Set 8 bit register bits by a superposed index-offset-based read from classical memory.
Definition: qpager.cpp:1277
void Copy(QInterfacePtr orig)
Definition: qpager.hpp:102
void SingleBitGate(bitLenInt target, Qubit1Fn fn, bool isSqiCtrl=false, bool isAnti=false)
Definition: qpager.cpp:369
void SetConcurrency(uint32_t threadsPerEngine)
Set the number of threads in parallel for loops, per component QEngine.
Definition: qpager.hpp:158
void Decompose(bitLenInt start, QInterfacePtr dest)
Minimally decompose a set of contiguous bits from the separably composed unit, into "destination".
Definition: qpager.hpp:336
std::vector< QInterfaceEngine > engines
Definition: qpager.hpp:47
QEnginePtr CloneEmpty()
Clone this QEngine's settings, with a zeroed state vector.
Definition: qpager.cpp:1630
QEnginePtr ReleaseEngine()
Definition: qpager.hpp:175
bitLenInt Compose(QPagerPtr toCopy)
Definition: qpager.hpp:331
real1_f ExpVarBitsAll(bool isExp, const std::vector< bitLenInt > &bits, const bitCapInt &offset=ZERO_BCI)
Definition: qpager.cpp:1548
bool GetTInjection()
Get the option to use T-injection gadgets.
Definition: qpager.hpp:172
complex phaseFactor
Definition: qpager.hpp:44
void CDIV(const bitCapInt &toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Controlled division by power of integer.
Definition: qpager.cpp:1232
real1_f SumSqrDiff(QInterfacePtr toCompare)
Calculates (1 - <\psi_e|\psi_c>) between states |\psi_c> and |\psi_e>.
Definition: qpager.hpp:526
bitLenInt Compose(QInterfacePtr toCopy)
Combine another QInterface with this one, after the last bit index of this one.
Definition: qpager.hpp:332
void SeparateEngines()
Definition: qpager.hpp:74
void ZMask(const bitCapInt &mask)
Masked Z gate.
Definition: qpager.hpp:374
QInterfaceEngine rootEngine
Definition: qpager.hpp:41
void SetDeviceList(std::vector< int64_t > dIDs)
Set the device index list, if more than one device is available.
Definition: qpager.hpp:489
int64_t devID
Definition: qpager.hpp:40
void SetPermutation(const bitCapInt &perm, const complex &phaseFac=CMPLX_DEFAULT_ARG)
Set to a specific permutation of all qubits.
Definition: qpager.cpp:935
bitLenInt ComposeNoClone(QPagerPtr toCopy)
Definition: qpager.hpp:333
void SetDevice(int64_t dID)
Set GPU device ID.
Definition: qpager.hpp:483
QPager(std::vector< QInterfaceEngine > eng, bitLenInt qBitCount, const bitCapInt &initState=ZERO_BCI, qrack_rand_gen_ptr rgp=nullptr, const complex &phaseFac=CMPLX_DEFAULT_ARG, bool doNorm=false, bool ignored=false, bool useHostMem=false, int64_t deviceId=-1, bool useHardwareRNG=true, bool useSparseStateVec=false, real1_f norm_thresh=REAL1_EPSILON, std::vector< int64_t > devList={}, bitLenInt qubitThreshold=0U, real1_f separation_thresh=_qrack_qunit_sep_thresh)
Definition: qpager.cpp:33
void CopyStateVec(QEnginePtr src)
Exactly copy the state vector of a different QEngine instance.
Definition: qpager.hpp:195
complex GetAmplitude(const bitCapInt &perm)
Get the representational amplitude of a full permutation.
Definition: qpager.hpp:308
bitCapInt IndexedSBC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, bitLenInt carryIndex, const unsigned char *values)
Subtract from an entangled 8 bit register state with a superposed index-offset-based read from classi...
Definition: qpager.cpp:1290
void Copy(QPagerPtr orig)
Definition: qpager.hpp:103
void CMULModNOut(const bitCapInt &toMul, const bitCapInt &modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Controlled multiplication modulo N by integer, (out of place)
Definition: qpager.cpp:1243
void IISwap(bitLenInt qubit1, bitLenInt qubit2)
Inverse ISwap - Swap values of two bits in register, and apply phase factor of -i if bits are differe...
Definition: qpager.hpp:426
bitLenInt Allocate(bitLenInt start, bitLenInt length)
Allocate new "length" count of |0> state qubits at specified qubit index start position.
Definition: qpager.cpp:797
bitLenInt baseQubitsPerPage
Definition: qpager.hpp:39
std::vector< bool > devicesHostPointer
Definition: qpager.hpp:45
void ISwap(bitLenInt qubit1, bitLenInt qubit2)
Swap values of two bits in register, and apply phase factor of i if bits are different.
Definition: qpager.hpp:425
real1_f GetRunningNorm()
Get in-flight renormalization factor.
Definition: qpager.hpp:284
int64_t GetDevice()
Get GPU device ID.
Definition: qpager.hpp:521
void LockEngine(QEnginePtr eng)
Definition: qpager.hpp:181
QEnginePtr MakeEngine(bitLenInt length, bitCapIntOcl pageId)
Definition: qpager.cpp:284
void Finish()
If asynchronous work is still running, block until it finishes.
Definition: qpager.hpp:455
bool GetPageHostPointer(bitCapIntOcl page)
Definition: qpager.hpp:69
void Hash(bitLenInt start, bitLenInt length, const unsigned char *values)
Transform a length of qubit register via lookup through a hash table.
Definition: qpager.cpp:1296
bitLenInt maxPageQubits
Definition: qpager.hpp:37
void ApplyM(const bitCapInt &regMask, const bitCapInt &result, const complex &nrm)
Definition: qpager.hpp:268
void SetAmplitudePage(QEnginePtr pageEnginePtr, bitCapIntOcl srcOffset, bitCapIntOcl dstOffset, bitCapIntOcl length)
Copy a "page" of amplitudes from another QEngine, pointed to by pageEnginePtr, into this QEngine's in...
Definition: qpager.hpp:224
bitLenInt ComposeEither(QPagerPtr toCopy, bool willDestroy)
Definition: qpager.cpp:616
bitLenInt qubitsPerPage()
Definition: qpager.hpp:67
void PhaseParity(real1_f radians, const bitCapInt &mask)
Parity phase gate.
Definition: qpager.cpp:1089
void UpdateRunningNorm(real1_f norm_thresh=REAL1_DEFAULT_ARG)
Force a calculation of the norm of the state vector, in order to make it unit length before the next ...
Definition: qpager.cpp:1594
real1_f Prob(bitLenInt qubitIndex)
Direct measure of bit probability to be in |1> state.
Definition: qpager.cpp:1466
void CUniformParityRZ(const std::vector< bitLenInt > &controls, const bitCapInt &mask, real1_f angle)
If the controls are set and the target qubit set parity is odd, this applies a phase factor of .
Definition: qpager.cpp:1064
void ShuffleBuffers(QEnginePtr engine)
Swap the high half of this engine with the low half of another.
Definition: qpager.hpp:234
std::vector< QEnginePtr > qPages
Definition: qpager.hpp:48
void CombineAndOpControlled(F fn, std::vector< bitLenInt > bits, const std::vector< bitLenInt > &controls)
Definition: qpager.cpp:607
int64_t GetPageDevice(bitCapIntOcl page)
Definition: qpager.hpp:68
void CIMULModNOut(const bitCapInt &toMul, const bitCapInt &modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Inverse of controlled multiplication modulo N by integer, (out of place)
Definition: qpager.cpp:1254
void IMULModNOut(const bitCapInt &toMul, const bitCapInt &modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length)
Inverse of multiplication modulo N by integer, (out of place)
Definition: qpager.cpp:1209
bool useGpuThreshold
Definition: qpager.hpp:33
bool IsZeroAmplitude()
Returns "true" only if amplitudes are all totally 0.
Definition: qpager.hpp:206
void ApplySingleEither(bool isInvert, const complex &top, const complex &bottom, bitLenInt target)
Definition: qpager.cpp:967
bitLenInt ComposeNoClone(QInterfacePtr toCopy)
This is a variant of Compose() for a toCopy argument that will definitely not be reused once "Compose...
Definition: qpager.hpp:334
void Phase(const complex &topLeft, const complex &bottomRight, bitLenInt qubitIndex)
Apply a single bit transformation that only effects phase.
Definition: qpager.hpp:345
void GetAmplitudePage(complex *pagePtr, bitCapIntOcl offset, bitCapIntOcl length)
Copy a "page" of amplitudes from this QEngine's internal state, into pagePtr.
Definition: qpager.hpp:216
void ZeroAmplitudes()
Set all amplitudes to 0, and optionally temporarily deallocate state vector RAM.
Definition: qpager.hpp:189
void QueueSetRunningNorm(real1_f runningNrm)
Add an operation to the (OpenCL) queue, to set the value of runningNorm, which is the normalization c...
Definition: qpager.hpp:257
bool isOpenCL()
Returns "true" if current simulation is OpenCL-based.
Definition: qpager.hpp:173
void MetaSwap(bitLenInt qubit1, bitLenInt qubit2, bool isIPhaseFac, bool isInverse)
Definition: qpager.cpp:1314
bitLenInt maxPageSetting
Definition: qpager.hpp:36
bool ForceM(bitLenInt qubit, bool result, bool doForce=true, bool doApply=true)
PSEUDO-QUANTUM - Acts like a measurement gate, except with a specified forced result.
Definition: qpager.cpp:1117
std::vector< int64_t > deviceIDs
Definition: qpager.hpp:46
bitCapInt ForceMReg(bitLenInt start, bitLenInt length, const bitCapInt &result, bool doForce=true, bool doApply=true)
Measure permutation state of a register.
Definition: qpager.hpp:378
bool useTGadget
Definition: qpager.hpp:35
void INCBCD(const bitCapInt &toAdd, bitLenInt start, bitLenInt length)
Add classical BCD integer (without sign)
Definition: qpager.cpp:1182
std::vector< int64_t > GetDeviceList()
Get the device index.
Definition: qpager.hpp:522
void INCDECBCDC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Common driver method behind INCSC and DECSC (without overflow flag)
Definition: qpager.cpp:1187
void POWModNOut(const bitCapInt &base, const bitCapInt &modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length)
Raise a classical base to a quantum power, modulo N, (out of place)
Definition: qpager.cpp:1215
void MetaControlled(const bitCapInt &controlPerm, const std::vector< bitLenInt > &controls, bitLenInt target, Qubit1Fn fn, const complex *mtrx, bool isSqiCtrl=false, bool isIntraCtrled=false)
Definition: qpager.cpp:453
void Invert(const complex &topRight, const complex &bottomLeft, bitLenInt qubitIndex)
Apply a single bit transformation that reverses bit probability and might effect phase.
Definition: qpager.hpp:349
Half-precision floating-point type.
Definition: half.hpp:2222
virtual void U(bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
General unitary gate.
Definition: rotational.cpp:18
virtual bitCapInt ForceMReg(bitLenInt start, bitLenInt length, const bitCapInt &result, bool doForce=true, bool doApply=true)
Act as if is a measurement was applied, except force the (usually random) result.
Definition: qinterface.cpp:213
GLOSSARY: bitLenInt - "bit-length integer" - unsigned integer ID of qubit position in register bitCap...
Definition: complex16x2simd.hpp:25
QInterfaceEngine
Enumerated list of supported engines.
Definition: qinterface.hpp:37
@ QINTERFACE_CUDA
Create a QEngineCUDA, leveraging CUDA hardware to increase the speed of certain calculations.
Definition: qinterface.hpp:52
@ QINTERFACE_OPENCL
Create a QEngineOCL, leveraging OpenCL hardware to increase the speed of certain calculations.
Definition: qinterface.hpp:47
@ QINTERFACE_CPU
Create a QEngineCPU leveraging only local CPU and memory resources.
Definition: qinterface.hpp:42
std::shared_ptr< QEngine > QEnginePtr
Definition: qrack_types.hpp:159
std::shared_ptr< QInterface > QInterfacePtr
Definition: qinterface.hpp:29
const real1_f _qrack_qunit_sep_thresh
Definition: qrack_functions.hpp:249
bitLenInt log2Ocl(bitCapIntOcl n)
Definition: qrack_functions.hpp:95
std::complex< real1 > complex
Definition: qrack_types.hpp:136
bitCapInt pow2(const bitLenInt &p)
Definition: qrack_functions.hpp:143
QRACK_CONST real1 REAL1_EPSILON
Definition: qrack_types.hpp:208
float real1_f
Definition: qrack_types.hpp:103
QRACK_CONST complex CMPLX_DEFAULT_ARG
Definition: qrack_types.hpp:267
std::shared_ptr< QPager > QPagerPtr
Definition: qpager.hpp:24
QRACK_CONST real1 PI_R1
Definition: qrack_types.hpp:186
const bitCapInt ZERO_BCI
Definition: qrack_types.hpp:138
bitCapIntOcl pow2Ocl(const bitLenInt &p)
Definition: qrack_functions.hpp:144
#define REAL1_DEFAULT_ARG
Definition: qrack_types.hpp:185
#define bitLenInt
Definition: qrack_types.hpp:42
#define ZERO_R1_F
Definition: qrack_types.hpp:168
#define qrack_rand_gen_ptr
Definition: qrack_types.hpp:164
#define bitCapInt
Definition: qrack_types.hpp:66
#define bitCapIntOcl
Definition: qrack_types.hpp:54