26 #define QINTERFACE_TO_QALU(qReg) std::dynamic_pointer_cast<QAlu>(qReg)
27 #define QINTERFACE_TO_QPARITY(qReg) std::dynamic_pointer_cast<QParity>(qReg)
68 throw bad_alloc(
"RAM limits exceeded in QBdt::SetTraversal()");
71 root = std::make_shared<QBdtNode>();
72 #if ENABLE_QBDT_CPU_PARALLEL && ENABLE_PTHREAD
74 std::lock_guard<std::mutex> lock(
root->mtx);
114 const bool toRet = operation(qReg);
131 return (perm & power) | ((perm >> 1U) & ~power);
144 for (
size_t i = 0
U; i < qPowers.size(); ++i) {
168 bool randomGlobalPhase =
true,
bool useHostMem =
false, int64_t deviceId = -1,
bool useHardwareRNG =
true,
169 bool useSparseStateVec =
false,
real1_f norm_thresh =
REAL1_EPSILON, std::vector<int64_t> ignored = {},
174 bool useHostMem =
false, int64_t deviceId = -1,
bool useHardwareRNG =
true,
bool useSparseStateVec =
false,
177 :
QBdt({
QINTERFACE_HYBRID }, qBitCount, initState, rgp, phaseFac, doNorm, randomGlobalPhase, useHostMem,
178 deviceId, useHardwareRNG, useSparseStateVec, norm_thresh, devList, qubitThreshold, separation_thresh)
248 const bitLenInt length = dest->GetQubitCount();
273 "QBdt::TrySeparate parameter qubit array values must be within allocated qubit bounds!");
275 if (!_qubits.size() || (_qubits.size() ==
qubitCount)) {
279 std::vector<bitLenInt> qubits(_qubits);
280 std::sort(qubits.begin(), qubits.end());
281 for (
size_t i = 0
U; i < qubits.size(); ++i) {
285 for (
bitLenInt i = qubits.size(); i > 0
U; --i) {
286 Swap(i - 1U, qubits[i - 1U]);
294 throw std::invalid_argument(
"QBdt::TrySeparate argument out-of-bounds!");
308 if (qubit1 == qubit2) {
309 throw std::invalid_argument(
"QBdt::TrySeparate qubits must be distinct!");
312 throw std::invalid_argument(
"QBdt::TrySeparate argument out-of-bounds!");
317 if (qubit1 > qubit2) {
318 std::swap(qubit1, qubit2);
334 return Compose(std::dynamic_pointer_cast<QBdt>(toCopy), start);
338 QBdtPtr d = std::dynamic_pointer_cast<QBdt>(dest);
518 bitLenInt length,
const std::vector<bitLenInt>& controls)
523 bitLenInt length,
const std::vector<bitLenInt>& controls)
578 const std::vector<bitLenInt>& controls)
584 const std::vector<bitLenInt>& controls)
590 bitLenInt length,
const std::vector<bitLenInt>& controls)
593 QINTERFACE_TO_QALU(eng)->CPOWModNOut(base, modN, inStart, outStart, length, controls);
597 const unsigned char* values,
bool resetValue =
true)
601 indexStart, indexLength, valueStart, valueLength, values, resetValue);
605 bitLenInt carryIndex,
const unsigned char* values)
609 indexStart, indexLength, valueStart, valueLength, carryIndex, values);
613 bitLenInt carryIndex,
const unsigned char* values)
617 indexStart, indexLength, valueStart, valueLength, carryIndex, values);
void bi_or_ip(BigInteger *left, const BigInteger &right)
Definition: big_integer.hpp:444
void bi_decrement(BigInteger *pBigInt, const BIG_INTEGER_WORD &value)
Definition: big_integer.hpp:237
int bi_and_1(const BigInteger &left)
Definition: big_integer.hpp:417
int bi_compare_0(const BigInteger &left)
Definition: big_integer.hpp:140
void MCMtrx(const std::vector< bitLenInt > &controls, const complex *mtrx, bitLenInt target)
Apply an arbitrary single bit unitary transformation, with arbitrary control bits.
Definition: tree.cpp:593
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: qbdt.hpp:589
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: qbdt.hpp:604
void CINC(const bitCapInt &toAdd, bitLenInt inOutStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Add integer (without sign, with controls)
Definition: qbdt.hpp:495
bool TrySeparate(bitLenInt qubit)
Single-qubit TrySeparate()
Definition: qbdt.hpp:291
void SetQuantumState(QInterfacePtr eng)
Definition: qbdt.hpp:221
bitCapInt SampleClone(const std::vector< bitCapInt > &qPowers)
Definition: qbdt.hpp:140
void DIV(const bitCapInt &toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length)
Divide by integer.
Definition: qbdt.hpp:566
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: qbdt.hpp:196
void Copy(QBdtPtr orig)
Definition: qbdt.hpp:154
bool BoolAsStateVector(Fn operation)
Definition: qbdt.hpp:110
void INCC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Add integer (without sign, with carry)
Definition: qbdt.hpp:479
void ISqrtSwap(bitLenInt q1, bitLenInt q2)
Inverse square root of Swap gate.
Definition: qbdt.hpp:400
bool TrySeparate(bitLenInt qubit1, bitLenInt qubit2)
Two-qubit TrySeparate()
Definition: qbdt.hpp:306
void INCDECSC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex, bitLenInt carryIndex)
Common driver method behind INCSC and DECSC (with overflow flag)
Definition: qbdt.hpp:538
void ISwap(bitLenInt q1, bitLenInt q2)
Swap values of two bits in register, and apply phase factor of i if bits are different.
Definition: qbdt.hpp:379
virtual bitLenInt Allocate(bitLenInt length)
Allocate new "length" count of |0> state qubits at end of qubit index position.
Definition: qinterface.hpp:477
void MULModNOut(const bitCapInt &toMul, const bitCapInt &modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length)
Multiplication modulo N by integer, (out of place)
Definition: qbdt.hpp:507
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: qbdt.hpp:527
void ApplyControlledSingle(const complex *mtrx, std::vector< bitLenInt > controls, bitLenInt target, bool isAnti)
Definition: tree.cpp:504
void Copy(QInterfacePtr orig)
Definition: qbdt.hpp:153
void Dispose(bitLenInt start, bitLenInt length, const bitCapInt &disposedPerm)
Dispose a a contiguous set of qubits that are already in a permutation eigenstate.
Definition: qbdt.hpp:344
void MUL(const bitCapInt &toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length)
Multiply by integer.
Definition: qbdt.hpp:561
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: qbdt.hpp:596
void INCDECC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Common driver method behind INCC and DECC (without sign, with carry)
Definition: qbdt.hpp:503
virtual bitLenInt Compose(QInterfacePtr toCopy)
Combine another QInterface with this one, after the last bit index of this one.
Definition: qinterface.hpp:371
bitCapInt bdtMaxQPower
Definition: qbdt.hpp:43
bool IsSeparable(bitLenInt start)
Inexpensive check for whether the QBdt is separable between low and high qubit indices at the biparti...
Definition: tree.cpp:276
real1_f Prob(bitLenInt qubitIndex)
Direct measure of bit probability to be in |1> state.
Definition: tree.cpp:350
size_t CountBranches()
Definition: tree.cpp:95
bool TryDecompose(bitLenInt start, QInterfacePtr dest, real1_f error_tol=TRYDECOMPOSE_EPSILON)
Attempt to Decompose() a bit range.
Definition: qbdt.hpp:242
void Init()
Definition: tree.cpp:39
int64_t devID
Definition: qbdt.hpp:41
bitCapInt MAll()
Measure permutation state of all coherent bits.
Definition: qbdt.hpp:360
void DecomposeDispose(bitLenInt start, bitLenInt length, QBdtPtr dest)
Definition: tree.cpp:248
void Mtrx(const complex *mtrx, bitLenInt target)
Apply an arbitrary single bit unitary transformation.
Definition: tree.cpp:591
void CISqrtSwap(const std::vector< bitLenInt > &controls, bitLenInt q1, bitLenInt q2)
Apply an inverse square root of swap with arbitrary control bits.
Definition: qbdt.hpp:421
void INCDECBCDC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Common driver method behind INCSC and DECSC (without overflow flag)
Definition: qbdt.hpp:555
void SetAmplitude(const bitCapInt &perm, const complex &)
Sets the representational amplitude of a full permutation.
Definition: qbdt.hpp:231
bool TrySeparate(const std::vector< bitLenInt > &_qubits, real1_f error_tol)
Qrack::QUnit types maintain explicit separation of representations of qubits, which reduces memory us...
Definition: qbdt.hpp:270
void MCInvert(const std::vector< bitLenInt > &controls, const complex &topRight, const complex &bottomLeft, bitLenInt target)
Apply a single bit transformation that reverses bit probability and might effect phase,...
Definition: tree.cpp:645
std::vector< int64_t > deviceIDs
Definition: qbdt.hpp:44
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: qbdt.hpp:446
void Dispose(bitLenInt start, bitLenInt length)
Minimally decompose a set of contiguous bits from the separably composed unit, and discard the separa...
Definition: qbdt.hpp:342
void SetPermutation(const bitCapInt &initState, const complex &phaseFac=CMPLX_DEFAULT_ARG)
Set to a specific permutation of all qubits.
Definition: tree.cpp:125
void FSim(real1_f theta, real1_f phi, bitLenInt qubitIndex1, bitLenInt qubitIndex2)
The 2-qubit "fSim" gate, (useful in the simulation of particles with fermionic statistics)
Definition: tree.cpp:669
void Swap(bitLenInt q1, bitLenInt q2)
Swap values of two bits in register.
Definition: qbdt.hpp:372
QBdt(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 randomGlobalPhase=true, bool useHostMem=false, int64_t deviceId=-1, bool useHardwareRNG=true, bool useSparseStateVec=false, real1_f norm_thresh=REAL1_EPSILON, std::vector< int64_t > ignored={}, bitLenInt qubitThreshold=0, real1_f separation_thresh=_qrack_qunit_sep_thresh)
Definition: tree.cpp:24
QBdt(bitLenInt qBitCount, const bitCapInt &initState=ZERO_BCI, qrack_rand_gen_ptr rgp=nullptr, const complex &phaseFac=CMPLX_DEFAULT_ARG, bool doNorm=false, bool randomGlobalPhase=true, 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: qbdt.hpp:172
void SetDevice(int64_t dID)
Set the device index, if more than one device is available.
Definition: qbdt.hpp:186
void GetTraversal(Fn getLambda)
Definition: qbdt.hpp:49
void CSwap(const std::vector< bitLenInt > &controls, bitLenInt q1, bitLenInt q2)
Apply a swap with arbitrary control bits.
Definition: qbdt.hpp:407
void par_for_qbdt(const bitCapInt &end, bitLenInt maxQubit, BdtFunc fn, bool branch=true)
Definition: tree.cpp:64
real1_f SumSqrDiff(QInterfacePtr toCompare)
Calculates (1 - <\psi_e|\psi_c>) between states |\psi_c> and |\psi_e>.
Definition: qbdt.hpp:202
void ApplySingle(const complex *mtrx, bitLenInt target)
Definition: tree.cpp:446
void SetTraversal(Fn setLambda)
Definition: qbdt.hpp:65
bitLenInt Compose(QInterfacePtr toCopy, bitLenInt start)
Compose() a QInterface peer, inserting its qubit into index order at start index.
Definition: qbdt.hpp:332
void GetQuantumState(QInterfacePtr eng)
Definition: qbdt.hpp:213
bitCapInt BitCapIntAsStateVector(Fn operation)
Definition: qbdt.hpp:101
bool M(bitLenInt q)
Definition: qbdt.hpp:474
void INCBCD(const bitCapInt &toAdd, bitLenInt start, bitLenInt length)
Add classical BCD integer (without sign)
Definition: qbdt.hpp:551
bitCapInt MAllOptionalCollapse(bool isCollapsing)
Definition: tree.cpp:403
void SetQuantumState(const complex *state)
Set an arbitrary pure quantum state representation.
Definition: qbdt.hpp:217
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: qbdt.hpp:512
bool ForceM(bitLenInt qubit, bool result, bool doForce=true, bool doApply=true)
Act as if is a measurement was applied, except force the (usually random) result.
Definition: qbdt.hpp:356
void Hash(bitLenInt start, bitLenInt length, const unsigned char *values)
Transform a length of qubit register via lookup through a hash table.
Definition: qbdt.hpp:620
void GetProbs(real1 *outputProbs)
Get the pure quantum state representation.
Definition: qbdt.hpp:225
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: qbdt.hpp:191
QEnginePtr MakeQEngine(bitLenInt qbCount, const bitCapInt &perm=ZERO_BCI)
Definition: tree.cpp:58
void IISwap(bitLenInt q1, bitLenInt q2)
Inverse ISwap - Swap values of two bits in register, and apply phase factor of -i if bits are differe...
Definition: qbdt.hpp:386
void MCPhase(const std::vector< bitLenInt > &controls, const complex &topLeft, const complex &bottomRight, bitLenInt target)
Apply a single bit transformation that only effects phase, with arbitrary control bits.
Definition: tree.cpp:620
void DECC(const bitCapInt &toSub, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Subtract classical integer (without sign, with carry)
Definition: qbdt.hpp:483
void SqrtSwap(bitLenInt q1, bitLenInt q2)
Square root of Swap gate.
Definition: qbdt.hpp:393
void INC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length)
Add integer (without sign)
Definition: qbdt.hpp:477
complex GetAmplitude(const bitCapInt &perm)
Get the representational amplitude of a full permutation.
Definition: tree.cpp:194
void _par_for(const bitCapInt &end, ParallelFuncBdt fn)
Definition: tree.cpp:88
static bitCapInt RemovePower(const bitCapInt &perm, bitCapInt power)
Definition: qbdt.hpp:128
std::vector< int64_t > GetDeviceList()
Get the device index.
Definition: qbdt.hpp:189
static size_t SelectBit(const bitCapInt &perm, bitLenInt bit)
Definition: qbdt.hpp:126
void INCS(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex)
Add a classical integer to the register, with sign and without carry.
Definition: qbdt.hpp:487
void DECS(const bitCapInt &toSub, bitLenInt start, bitLenInt length, bitLenInt overflowIndex)
Add a classical integer to the register, with sign and without carry.
Definition: qbdt.hpp:491
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: qbdt.hpp:522
bool isBinaryDecisionTree()
Returns "true" if current state representation is definitely a binary decision tree,...
Definition: qbdt.hpp:184
void CSqrtSwap(const std::vector< bitLenInt > &controls, bitLenInt q1, bitLenInt q2)
Apply a square root of swap with arbitrary control bits.
Definition: qbdt.hpp:414
void Decompose(bitLenInt start, QInterfacePtr dest)
Minimally decompose a set of contiguous bits from the separably composed unit, into "destination".
Definition: qbdt.hpp:336
std::vector< QInterfaceEngine > engines
Definition: qbdt.hpp:45
real1_f ProbParity(const bitCapInt &mask)
Overall probability of any odd permutation of the masked set of bits.
Definition: qbdt.hpp:429
void CDIV(const bitCapInt &toDiv, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Controlled division by power of integer.
Definition: qbdt.hpp:583
void INCDECSC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Common driver method behind INCSC and DECSC (without overflow flag)
Definition: qbdt.hpp:545
void ExecuteAsStateVector(Fn operation)
Definition: qbdt.hpp:93
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: qbdt.hpp:532
void X(bitLenInt q)
Definition: qbdt.hpp:476
void GetQuantumState(complex *state)
Get the pure quantum state representation.
Definition: qbdt.hpp:209
bitLenInt bdtStride
Definition: qbdt.hpp:40
QInterfacePtr Clone()
Clone this QInterface.
Definition: tree.cpp:150
void DEC(const bitCapInt &toSub, bitLenInt start, bitLenInt length)
Add integer (without sign)
Definition: qbdt.hpp:478
void CMUL(const bitCapInt &toMul, bitLenInt inOutStart, bitLenInt carryStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Controlled multiplication by integer.
Definition: qbdt.hpp:577
QBdtNodeInterfacePtr root
Definition: qbdt.hpp:42
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: qbdt.hpp:451
void CDEC(const bitCapInt &toSub, bitLenInt inOutStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Subtract integer (without sign, with controls)
Definition: qbdt.hpp:499
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: tree.cpp:606
void SetDeviceList(std::vector< int64_t > dIDs)
Set the device index list, if more than one device is available.
Definition: qbdt.hpp:187
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: qbdt.hpp:612
real1_f ProbAll(const bitCapInt &fullRegister)
Direct measure of full permutation probability.
Definition: tree.cpp:387
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: qbdt.hpp:517
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: qbdt.hpp:571
int64_t GetDevice()
Get the device index.
Definition: qbdt.hpp:188
A "Qrack::QInterface" is an abstract interface exposing qubit permutation state vector with methods t...
Definition: qinterface.hpp:141
bitCapInt maxQPower
Definition: qinterface.hpp:149
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
bitLenInt qubitCount
Definition: qinterface.hpp:146
Definition: qparity.hpp:22
Definition: qengine_gpu_util.hpp:21
Half-precision floating-point type.
Definition: half.hpp:2222
virtual void MULModNOut(const bitCapInt &toMul, const bitCapInt &modN, bitLenInt inStart, bitLenInt outStart, bitLenInt length)
Multiplication modulo N by integer, (out of place)
Definition: arithmetic.cpp:127
virtual void DECS(const bitCapInt &toSub, bitLenInt start, bitLenInt length, bitLenInt overflowIndex)
Subtract a classical integer from the register, with sign and without carry.
Definition: qinterface.hpp:2200
virtual void INCDECC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Common driver method behind INCC and DECC.
Definition: arithmetic.cpp:53
virtual void CINC(const bitCapInt &toAdd, bitLenInt inOutStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Add integer (without sign, with controls)
Definition: arithmetic.cpp:79
virtual void INCS(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt overflowIndex)
Add a classical integer to the register, with sign and without carry.
Definition: qinterface.hpp:2189
virtual void DECC(const bitCapInt &toSub, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Subtract classical integer (without sign, with carry)
Definition: qinterface.hpp:2163
virtual void DEC(const bitCapInt &toSub, bitLenInt start, bitLenInt length)
Subtract classical integer (without sign)
Definition: qinterface.hpp:2141
virtual void INC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length)
Add integer (without sign)
Definition: arithmetic.cpp:20
virtual 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: arithmetic.cpp:165
virtual void CDEC(const bitCapInt &toSub, bitLenInt inOutStart, bitLenInt length, const std::vector< bitLenInt > &controls)
Subtract classical integer (without sign, with controls)
Definition: qinterface.hpp:2181
virtual void INCC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length, bitLenInt carryIndex)
Add integer (without sign, with carry)
Definition: qinterface.hpp:2151
virtual 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: arithmetic.cpp:201
virtual 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: arithmetic.cpp:240
virtual void CSqrtSwap(const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
Apply a square root of swap with arbitrary control bits.
Definition: gates.cpp:282
virtual void CISqrtSwap(const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
Apply an inverse square root of swap with arbitrary control bits.
Definition: gates.cpp:331
virtual void X(bitLenInt qubit)
X gate.
Definition: qinterface.hpp:1091
virtual void U(bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
General unitary gate.
Definition: rotational.cpp:18
virtual bool M(bitLenInt qubit)
Measurement gate.
Definition: qinterface.hpp:1020
virtual void CSwap(const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
Apply a swap with arbitrary control bits.
Definition: gates.cpp:247
virtual QInterfacePtr Copy()
Copy this QInterface.
Definition: qinterface.hpp:2992
virtual bool TryDecompose(bitLenInt start, QInterfacePtr dest, real1_f error_tol=TRYDECOMPOSE_EPSILON)
Attempt to Decompose() a bit range.
Definition: qinterface.cpp:834
virtual bool TrySeparate(const std::vector< bitLenInt > &qubits, real1_f error_tol)
Qrack::QUnit types maintain explicit separation of representations of qubits, which reduces memory us...
Definition: qinterface.hpp:2900
GLOSSARY: bitLenInt - "bit-length integer" - unsigned integer ID of qubit position in register bitCap...
Definition: complex16x2simd.hpp:25
void ThrowIfQbIdArrayIsBad(const std::vector< bitLenInt > &controls, const bitLenInt &qubitCount, std::string message)
Definition: qrack_functions.hpp:185
@ QINTERFACE_HYBRID
Create a QHybrid, switching between QEngineCPU and QEngineOCL as efficient.
Definition: qinterface.hpp:57
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
QRACK_CONST real1_f TRYDECOMPOSE_EPSILON
Definition: qrack_types.hpp:270
std::shared_ptr< QBdt > QBdtPtr
Definition: qbdt.hpp:31
std::function< bitCapInt(const bitCapInt &)> BdtFunc
Definition: qrack_types.hpp:146
std::complex< real1 > complex
Definition: qrack_types.hpp:136
const bitLenInt QRACK_MAX_CPU_QB_DEFAULT
Definition: qrack_functions.hpp:251
bitCapInt pow2(const bitLenInt &p)
Definition: qrack_functions.hpp:143
std::function< void(const bitCapInt &, const unsigned &cpu)> ParallelFuncBdt
Definition: qrack_types.hpp:147
double norm(const complex2 &c)
Definition: complex16x2simd.hpp:122
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< QBdtNodeInterface > QBdtNodeInterfacePtr
Definition: qbdt_node_interface.hpp:33
const bitCapInt ZERO_BCI
Definition: qrack_types.hpp:138
bitLenInt log2(bitCapInt n)
Definition: qrack_functions.hpp:141
#define QINTERFACE_TO_QALU(qReg)
Definition: qbdt.hpp:26
#define QINTERFACE_TO_QPARITY(qReg)
Definition: qbdt.hpp:27
#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