Qrack  1.7
General classical-emulating-quantum development framework
qengine_opencl.hpp
Go to the documentation of this file.
1 //
3 // (C) Daniel Strano and the Qrack contributors 2017, 2018. 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 General Public License V3.
10 // See LICENSE.md in the project root or https://www.gnu.org/licenses/gpl-3.0.en.html
11 // for details.
12 
13 #pragma once
14 
15 #if !ENABLE_OPENCL
16 #error OpenCL has not been enabled
17 #endif
18 
19 #include "qinterface.hpp"
20 
21 namespace Qrack {
22 
23 typedef std::shared_ptr<cl::Buffer> BufferPtr;
24 
25 class OCLEngine;
26 
27 class QEngineOCL;
28 
29 typedef std::shared_ptr<QEngineOCL> QEngineOCLPtr;
30 
32 class QEngineOCL : public QInterface {
33 protected:
35  int deviceID;
37  cl::CommandQueue queue;
38  cl::Context context;
39  // stateBuffer is allocated as a shared_ptr, because it's the only buffer that will be acted on outside of
40  // QEngineOCL itself, specifically by QEngineOCLMulti.
41  BufferPtr stateBuffer;
42  cl::Buffer cmplxBuffer;
43  cl::Buffer ulongBuffer;
44  cl::Buffer nrmBuffer;
46  size_t nrmGroupCount;
47  size_t nrmGroupSize;
48  size_t maxWorkItems;
49  unsigned int procElemCount;
50 
51  virtual void ApplyM(bitCapInt qPower, bool result, complex nrm);
52 
53 public:
66  QEngineOCL(bitLenInt qBitCount, bitCapInt initState, std::shared_ptr<std::default_random_engine> rgp = nullptr,
67  int devID = -1, bool partialInit = false, complex phaseFac = complex(-999.0, -999.0));
68  QEngineOCL(QEngineOCLPtr toCopy);
70  {
71  delete[] stateVec;
72  delete[] nrmArray;
73  }
74 
75  virtual void SetQubitCount(bitLenInt qb);
76 
77  virtual void EnableNormalize(bool doN) { doNormalize = doN; }
78  virtual real1 GetNorm(bool update = true)
79  {
80  if (update) {
82  }
83  return runningNorm;
84  }
85  virtual void SetNorm(real1 n) { runningNorm = n; }
86 
87  // CL_MAP_READ = (1 << 0); CL_MAP_WRITE = (1 << 1);
88  virtual void LockSync(cl_int flags = (CL_MAP_READ | CL_MAP_WRITE));
89  virtual void UnlockSync();
90  virtual void Sync();
91  virtual complex* GetStateVector() { return stateVec; }
92  virtual cl::Context& GetCLContext() { return context; }
93  virtual int GetCLContextID() { return device_context->context_id; }
94  virtual cl::CommandQueue& GetCLQueue() { return queue; }
95  virtual BufferPtr GetStateBuffer() { return stateBuffer; }
96  virtual void SetPermutation(bitCapInt perm);
97  virtual void CopyState(QInterfacePtr orig);
98  virtual real1 ProbAll(bitCapInt fullRegister);
99 
100  /* Operations that have an improved implementation. */
101  using QInterface::X;
102  virtual void X(bitLenInt start, bitLenInt length);
103  using QInterface::Swap;
104  virtual void Swap(bitLenInt start1, bitLenInt start2, bitLenInt length);
105 
106  virtual bitLenInt Cohere(QEngineOCLPtr toCopy);
107  virtual bitLenInt Cohere(QInterfacePtr toCopy) { return Cohere(std::dynamic_pointer_cast<QEngineOCL>(toCopy)); }
108  virtual void Decohere(bitLenInt start, bitLenInt length, QInterfacePtr dest);
109  virtual void Dispose(bitLenInt start, bitLenInt length);
110 
111  virtual void ROL(bitLenInt shift, bitLenInt start, bitLenInt length);
112  virtual void ROR(bitLenInt shift, bitLenInt start, bitLenInt length);
113 
114  virtual void INC(bitCapInt toAdd, bitLenInt start, bitLenInt length);
115  virtual void DEC(bitCapInt toSub, bitLenInt start, bitLenInt length);
116  virtual void INCC(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
117  virtual void DECC(bitCapInt toSub, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
118  virtual void INCS(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
119  virtual void DECS(bitCapInt toSub, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
120  virtual void INCSC(
121  bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex, bitLenInt carryIndex);
122  virtual void DECSC(
123  bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex, bitLenInt carryIndex);
124  virtual void INCSC(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
125  virtual void DECSC(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
126  virtual void INCBCD(bitCapInt toAdd, bitLenInt start, bitLenInt length);
127  virtual void DECBCD(bitCapInt toAdd, bitLenInt start, bitLenInt length);
128  virtual void INCBCDC(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
129  virtual void DECBCDC(bitCapInt toSub, bitLenInt start, bitLenInt length, bitLenInt carryIndex);
130  virtual void MUL(
131  bitCapInt toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length, bool clearCary = false);
132  virtual void DIV(bitCapInt toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length);
133  virtual void CMUL(bitCapInt toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt controlBit,
134  bitLenInt length, bool clearCarry = false);
135  virtual void CDIV(
136  bitCapInt toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt controlBit, bitLenInt length);
137 
138  virtual bitCapInt IndexedLDA(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart,
139  bitLenInt valueLength, unsigned char* values, bool isParallel);
141  bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, unsigned char* values)
142  {
143  return IndexedLDA(indexStart, indexLength, valueStart, valueLength, values, false);
144  }
145  virtual bitCapInt IndexedADC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart,
146  bitLenInt valueLength, bitLenInt carryIndex, unsigned char* values, bool isParallel);
147  virtual bitCapInt IndexedADC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart,
148  bitLenInt valueLength, bitLenInt carryIndex, unsigned char* values)
149  {
150  return IndexedADC(indexStart, indexLength, valueStart, valueLength, carryIndex, values, false);
151  }
152  virtual bitCapInt IndexedSBC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart,
153  bitLenInt valueLength, bitLenInt carryIndex, unsigned char* values, bool isParallel);
154  virtual bitCapInt IndexedSBC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart,
155  bitLenInt valueLength, bitLenInt carryIndex, unsigned char* values)
156  {
157  return IndexedSBC(indexStart, indexLength, valueStart, valueLength, carryIndex, values, false);
158  }
159 
160  virtual real1 Prob(bitLenInt qubit);
161 
162  virtual void PhaseFlip();
163  virtual void ZeroPhaseFlip(bitLenInt start, bitLenInt length);
164  virtual void CPhaseFlipIfLess(bitCapInt greaterPerm, bitLenInt start, bitLenInt length, bitLenInt flagIndex);
165 
166  virtual int GetDeviceID() { return deviceID; }
167  virtual void SetDevice(const int& dID, const bool& forceReInit = false);
168 
169  virtual void SetQuantumState(complex* inputState);
170 
171  virtual void NormalizeState(real1 nrm = -999.0);
172  virtual void UpdateRunningNorm();
173 
174 protected:
175  static const int BCI_ARG_LEN = 10;
176 
177  void InitOCL(int devID);
178  void ResetStateVec(complex* nStateVec, BufferPtr nStateBuffer);
179  virtual complex* AllocStateVec(bitCapInt elemCount);
180 
181  size_t FixWorkItemCount(size_t maxI, size_t wic);
182  size_t FixGroupSize(size_t wic, size_t gs);
183 
184  void DecohereDispose(bitLenInt start, bitLenInt length, QEngineOCLPtr dest);
185  void DispatchCall(OCLAPI api_call, bitCapInt (&bciArgs)[BCI_ARG_LEN], unsigned char* values = NULL,
186  bitCapInt valuesLength = 0, bool isParallel = false);
187 
188  void Apply2x2(bitCapInt offset1, bitCapInt offset2, const complex* mtrx, const bitLenInt bitCount,
189  const bitCapInt* qPowersSorted, bool doCalcNorm);
190 
191  /* Utility functions used by the operations above. */
192  void ROx(OCLAPI api_call, bitLenInt shift, bitLenInt start, bitLenInt length);
193  void INT(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length);
194  void INTC(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length,
195  const bitLenInt carryIndex);
196  void INTS(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length,
197  const bitLenInt overflowIndex);
198  void INTSC(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length,
199  const bitLenInt carryIndex);
200  void INTSC(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length,
201  const bitLenInt overflowIndex, const bitLenInt carryIndex);
202  void INTBCD(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length);
203  void INTBCDC(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length,
204  const bitLenInt carryIndex);
205 
206  bitCapInt OpIndexed(OCLAPI api_call, bitCapInt carryIn, bitLenInt indexStart, bitLenInt indexLength,
207  bitLenInt valueStart, bitLenInt valueLength, bitLenInt carryIndex, unsigned char* values, bool isParallel);
208 };
209 
210 } // namespace Qrack
virtual void DECSC(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex, bitLenInt carryIndex)
Subtract integer (with sign, with carry)
Definition: opencl.cpp:767
cl::Buffer ulongBuffer
Definition: qengine_opencl.hpp:43
void INTBCDC(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length, const bitLenInt carryIndex)
Add or Subtract integer (BCD, with carry)
Definition: opencl.cpp:848
virtual void Sync()
Definition: opencl.cpp:72
cl::Buffer nrmBuffer
Definition: qengine_opencl.hpp:44
virtual void UpdateRunningNorm()
Definition: opencl.cpp:1181
void INTC(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length, const bitLenInt carryIndex)
Add or Subtract integer (without sign, with carry)
Definition: opencl.cpp:670
virtual void DECBCD(bitCapInt toAdd, bitLenInt start, bitLenInt length)
Subtract integer (BCD)
Definition: opencl.cpp:842
bitCapInt OpIndexed(OCLAPI api_call, bitCapInt carryIn, bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, bitLenInt carryIndex, unsigned char *values, bool isParallel)
Add or Subtract based on an indexed load from classical memory.
Definition: opencl.cpp:1009
virtual int GetCLContextID()
Definition: qengine_opencl.hpp:93
OCLAPI
Definition: oclengine.hpp:38
void INT(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length)
Add or Subtract integer (without sign or carry)
Definition: opencl.cpp:646
size_t nrmGroupSize
Definition: qengine_opencl.hpp:47
virtual void DECBCDC(bitCapInt toSub, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Subtract integer (BCD, with carry)
Definition: opencl.cpp:878
real1 * nrmArray
Definition: qengine_opencl.hpp:45
virtual void X(bitLenInt start, bitLenInt length)
Bitwise Pauli X (or logical "NOT") operator.
Definition: opencl.cpp:599
virtual void CDIV(bitCapInt toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt controlBit, bitLenInt length)
Controlled division by integer.
Definition: opencl.cpp:956
virtual void ROL(bitLenInt shift, bitLenInt start, bitLenInt length)
"Circular shift left" - shift bits left, and carry last bits.
Definition: opencl.cpp:640
virtual void X(bitLenInt qubitIndex)
X gate.
Definition: gates.cpp:147
void Apply2x2(bitCapInt offset1, bitCapInt offset2, const complex *mtrx, const bitLenInt bitCount, const bitCapInt *qPowersSorted, bool doCalcNorm)
Definition: opencl.cpp:274
virtual bitCapInt IndexedLDA(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, unsigned char *values)
Set 8 bit register bits by a superposed index-offset-based read from classical memory.
Definition: qengine_opencl.hpp:140
virtual void SetQuantumState(complex *inputState)
Set arbitrary pure quantum state, in unsigned int permutation basis.
Definition: opencl.cpp:1137
static const int BCI_ARG_LEN
Definition: qengine_opencl.hpp:175
virtual void EnableNormalize(bool doN)
Definition: qengine_opencl.hpp:77
virtual complex * AllocStateVec(bitCapInt elemCount)
Definition: opencl.cpp:1208
real1 runningNorm
Definition: qinterface.hpp:103
virtual void PhaseFlip()
Phase flip always - equivalent to Z X Z X on any bit in the QInterface.
Definition: opencl.cpp:1071
std::shared_ptr< OCLDeviceContext > DeviceContextPtr
Definition: oclengine.hpp:34
virtual void SetQubitCount(bitLenInt qb)
Definition: opencl.cpp:203
virtual real1 Prob(bitLenInt qubit)
PSEUDO-QUANTUM Direct measure of bit probability to be in |1> state.
Definition: opencl.cpp:554
size_t nrmGroupCount
Definition: qengine_opencl.hpp:46
unsigned int procElemCount
Definition: qengine_opencl.hpp:49
#define real1
Definition: qinterface.hpp:36
virtual void LockSync(cl_int flags=(CL_MAP_READ|CL_MAP_WRITE))
Definition: opencl.cpp:61
virtual void Swap(bitLenInt start1, bitLenInt start2, bitLenInt length)
Bitwise swap.
Definition: opencl.cpp:614
void DispatchCall(OCLAPI api_call, bitCapInt(&bciArgs)[BCI_ARG_LEN], unsigned char *values=NULL, bitCapInt valuesLength=0, bool isParallel=false)
Definition: opencl.cpp:231
BufferPtr stateBuffer
Definition: qengine_opencl.hpp:41
virtual void Decohere(bitLenInt start, bitLenInt length, QInterfacePtr dest)
Minimally decohere a set of contiguous bits from the full coherent unit, into "destination.".
Definition: opencl.cpp:546
void INTS(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length, const bitLenInt overflowIndex)
Add or Subtract integer (with overflow, without carry)
Definition: opencl.cpp:710
void InitOCL(int devID)
Definition: opencl.cpp:209
~QEngineOCL()
Definition: qengine_opencl.hpp:69
void INTSC(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length, const bitLenInt carryIndex)
Add or Subtract integer (with sign, with carry)
Definition: opencl.cpp:781
virtual void DIV(bitCapInt toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length)
Divide by integer.
Definition: opencl.cpp:911
cl::CommandQueue queue
Definition: qengine_opencl.hpp:37
void ResetStateVec(complex *nStateVec, BufferPtr nStateBuffer)
Definition: opencl.cpp:211
virtual bitCapInt IndexedSBC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, bitLenInt carryIndex, unsigned char *values)
Subtract from an entangled 8 bit register state with a superposed index-offset-based read from classi...
Definition: qengine_opencl.hpp:154
virtual real1 GetNorm(bool update=true)
Definition: qengine_opencl.hpp:78
virtual BufferPtr GetStateBuffer()
Definition: qengine_opencl.hpp:95
virtual void SetPermutation(bitCapInt perm)
Set to a specific permutation.
Definition: opencl.cpp:219
void ROx(OCLAPI api_call, bitLenInt shift, bitLenInt start, bitLenInt length)
Definition: opencl.cpp:629
#define complex
Definition: qinterface.hpp:35
virtual void DEC(bitCapInt toSub, bitLenInt start, bitLenInt length)
Subtract integer (without sign, with carry)
Definition: opencl.cpp:664
virtual void INCS(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Increment integer (without sign, with carry)
Definition: opencl.cpp:726
virtual void MUL(bitCapInt toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length, bool clearCary=false)
Multiply by integer.
Definition: opencl.cpp:891
virtual void CPhaseFlipIfLess(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: opencl.cpp:1112
virtual void INCBCDC(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Increment integer (BCD, with carry)
Definition: opencl.cpp:866
virtual bitCapInt IndexedADC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, bitLenInt carryIndex, unsigned char *values, bool isParallel)
Add based on an indexed load from classical memory.
Definition: opencl.cpp:1056
OpenCL enhanced QEngineCPU implementation.
Definition: qengine_opencl.hpp:32
virtual bitCapInt IndexedSBC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, bitLenInt carryIndex, unsigned char *values, bool isParallel)
Subtract based on an indexed load from classical memory.
Definition: opencl.cpp:1064
size_t FixGroupSize(size_t wic, size_t gs)
Definition: opencl.cpp:86
virtual void DECC(bitCapInt toSub, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Subtract integer (without sign, with carry)
Definition: opencl.cpp:697
virtual real1 ProbAll(bitCapInt fullRegister)
Direct measure of full register probability to be in permutation state.
Definition: opencl.cpp:122
#define bitCapInt
Definition: qinterface.hpp:22
void INTBCD(OCLAPI api_call, bitCapInt toMod, const bitLenInt inOutStart, const bitLenInt length)
Add or Subtract integer (BCD)
Definition: opencl.cpp:821
void DecohereDispose(bitLenInt start, bitLenInt length, QEngineOCLPtr dest)
Definition: opencl.cpp:406
DeviceContextPtr device_context
Definition: qengine_opencl.hpp:36
virtual void CopyState(QInterfacePtr orig)
Direct copy of raw state vector to produce a clone.
Definition: opencl.cpp:102
virtual void Swap(bitLenInt qubitIndex1, bitLenInt qubitIndex2)
Swap values of two bits in register.
Definition: gates.cpp:61
#define bitLenInt
Definition: qinterface.hpp:21
QEngineOCL(bitLenInt qBitCount, bitCapInt initState, std::shared_ptr< std::default_random_engine > rgp=nullptr, int devID=-1, bool partialInit=false, complex phaseFac=complex(-999.0,-999.0))
Initialize a Qrack::QEngineOCL object.
Definition: opencl.cpp:22
virtual void DECS(bitCapInt toSub, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Subtract integer (without sign, with carry)
Definition: opencl.cpp:732
"Qrack::OCLEngine" manages the single OpenCL context.
Definition: oclengine.hpp:130
virtual bitCapInt IndexedLDA(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, unsigned char *values, bool isParallel)
Set 8 bit register bits based on read from classical memory.
Definition: opencl.cpp:977
virtual complex * GetStateVector()
Definition: qengine_opencl.hpp:91
int deviceID
Definition: qengine_opencl.hpp:35
virtual void INCBCD(bitCapInt toAdd, bitLenInt start, bitLenInt length)
Increment integer (BCD)
Definition: opencl.cpp:836
virtual void Dispose(bitLenInt start, bitLenInt length)
Minimally decohere a set of contigious bits from the full coherent unit, throwing these qubits away...
Definition: opencl.cpp:551
A "Qrack::QInterface" is an abstract interface exposing qubit permutation state vector with methods t...
Definition: qinterface.hpp:99
virtual bitCapInt IndexedADC(bitLenInt indexStart, bitLenInt indexLength, bitLenInt valueStart, bitLenInt valueLength, bitLenInt carryIndex, unsigned char *values)
Add to entangled 8 bit register state with a superposed index-offset-based read from classical memory...
Definition: qengine_opencl.hpp:147
bool doNormalize
Definition: qinterface.hpp:104
virtual void INCC(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Increment integer (without sign, with carry)
Definition: opencl.cpp:685
size_t maxWorkItems
Definition: qengine_opencl.hpp:48
virtual void SetNorm(real1 n)
Definition: qengine_opencl.hpp:85
virtual void ZeroPhaseFlip(bitLenInt start, bitLenInt length)
For chips with a zero flag, flip the phase of the state where the register equals zero...
Definition: opencl.cpp:1089
virtual void INCSC(bitCapInt toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex, bitLenInt carryIndex)
Increment integer (with sign, with carry)
Definition: opencl.cpp:754
std::shared_ptr< QEngineOCL > QEngineOCLPtr
Definition: qengine_opencl.hpp:27
virtual bitLenInt Cohere(QInterfacePtr toCopy)
Combine another QInterface with this one, after the last bit index of this one.
Definition: qengine_opencl.hpp:107
cl::Context context
Definition: qengine_opencl.hpp:38
complex * stateVec
Definition: qengine_opencl.hpp:34
std::shared_ptr< QInterface > QInterfacePtr
Definition: qinterface.hpp:46
virtual void SetDevice(const int &dID, const bool &forceReInit=false)
Definition: opencl.cpp:134
std::shared_ptr< cl::Buffer > BufferPtr
Definition: qengine_opencl.hpp:23
virtual void CMUL(bitCapInt toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt controlBit, bitLenInt length, bool clearCarry=false)
Controlled multiplication by integer.
Definition: opencl.cpp:931
size_t FixWorkItemCount(size_t maxI, size_t wic)
Definition: opencl.cpp:78
virtual int GetDeviceID()
Definition: qengine_opencl.hpp:166
virtual void UnlockSync()
Definition: opencl.cpp:66
Definition: complex16simd.hpp:21
virtual void ROR(bitLenInt shift, bitLenInt start, bitLenInt length)
"Circular shift right" - shift bits right, and carry first bits.
Definition: opencl.cpp:643
virtual void NormalizeState(real1 nrm=-999.0)
Definition: opencl.cpp:1145
virtual cl::Context & GetCLContext()
Definition: qengine_opencl.hpp:92
cl::Buffer cmplxBuffer
Definition: qengine_opencl.hpp:42
virtual cl::CommandQueue & GetCLQueue()
Definition: qengine_opencl.hpp:94
virtual bitLenInt Cohere(QEngineOCLPtr toCopy)
Definition: opencl.cpp:357
virtual void INC(bitCapInt toAdd, bitLenInt start, bitLenInt length)
Increment integer (without sign, with carry)
Definition: opencl.cpp:658
virtual void ApplyM(bitCapInt qPower, bool result, complex nrm)
Definition: opencl.cpp:330