114 #if ENABLE_OPENCL || ENABLE_CUDA
179 template <
typename Fn>
void MACWrapper(
const std::vector<bitLenInt>& controls, Fn fn)
182 for (
const bitLenInt& control : controls) {
197 for (
size_t i = 0
U; i < qPowers.size(); ++i) {
207 const std::vector<std::shared_ptr<complex>>& basisOps, std::vector<real1_f> eigenVals = {});
209 const std::vector<real1_f>& basisOps, std::vector<real1_f> eigenVals = {});
212 std::vector<bitCapInt> perms;
213 perms.reserve(bits.size() << 1U);
214 for (
size_t i = 0
U; i < bits.size(); ++i) {
216 perms.push_back(
pow2(i));
380 virtual std::map<QInterfacePtr, bitLenInt>
Compose(std::vector<QInterfacePtr> toCopy);
505 MACPhase(controls, mtrx[0
U], mtrx[3U], target);
507 MACInvert(controls, mtrx[1U], mtrx[2U], target);
509 MACWrapper(controls, [
this, mtrx, target](
const std::vector<bitLenInt>& lc) {
MCMtrx(lc, mtrx, target); });
553 MCMtrx(controls, mtrx, target);
564 MCMtrx(controls, mtrx, target);
577 MACWrapper(controls, [
this, topLeft, bottomRight, target](
const std::vector<bitLenInt>& lc) {
578 MCPhase(lc, topLeft, bottomRight, target);
589 MACWrapper(controls, [
this, topRight, bottomLeft, target](
const std::vector<bitLenInt>& lc) {
590 MCInvert(lc, topRight, bottomLeft, target);
606 UCMtrx(controls, mtrx, target, perm);
617 UCMtrx(controls, mtrx, target, perm);
635 const std::vector<bitLenInt>& controls,
bitLenInt qubit,
const complex* mtrxs)
640 const complex* mtrxs,
const std::vector<bitCapInt>& mtrxSkipPowers,
const bitCapInt& mtrxSkipValueMask);
696 const std::vector<bitLenInt> controls{ control1, control2 };
707 const std::vector<bitLenInt> controls{ control1, control2 };
718 const std::vector<bitLenInt> controls{ control };
729 const std::vector<bitLenInt> controls{ control };
741 const std::vector<bitLenInt> controls{ control };
752 const std::vector<bitLenInt> controls{ control };
764 const std::vector<bitLenInt> controls{ control1, control2 };
775 const std::vector<bitLenInt> controls{ control1, control2 };
787 const std::vector<bitLenInt> controls{ control };
798 const std::vector<bitLenInt> controls{ control };
810 const std::vector<bitLenInt> controls{ control1, control2 };
821 const std::vector<bitLenInt> controls{ control1, control2 };
1027 virtual bool ForceM(
bitLenInt qubit,
bool result,
bool doForce =
true,
bool doApply =
true) = 0;
1144 QRACK_CONST complex mtrx[4]{ ONE_PLUS_I_DIV_2, ONE_MINUS_I_DIV_2, ONE_MINUS_I_DIV_2, ONE_PLUS_I_DIV_2 };
1158 QRACK_CONST complex mtrx[4]{ ONE_MINUS_I_DIV_2, ONE_PLUS_I_DIV_2, ONE_PLUS_I_DIV_2, ONE_MINUS_I_DIV_2 };
1173 QRACK_CONST complex mtrx[4]{ ONE_PLUS_I_DIV_2, ONE_PLUS_I_DIV_2_NEG, ONE_PLUS_I_DIV_2, ONE_PLUS_I_DIV_2 };
1188 QRACK_CONST complex mtrx[4]{ ONE_MINUS_I_DIV_2, ONE_MINUS_I_DIV_2, ONE_MINUS_I_DIV_2_NEG, ONE_MINUS_I_DIV_2 };
1228 const std::vector<bitLenInt> controls{ control };
1232 MCMtrx(controls, mtrx, target);
1243 const std::vector<bitLenInt> controls{ control };
1247 MACMtrx(controls, mtrx, target);
1258 const std::vector<bitLenInt> controls{ control };
1270 const std::vector<bitLenInt> controls{ control };
1282 const std::vector<bitLenInt> controls{ control };
1294 const std::vector<bitLenInt> controls{ control };
1306 const std::vector<bitLenInt> controls{ control };
1318 const std::vector<bitLenInt> controls{ control };
1334 const std::vector<bitLenInt> controls{ control };
1350 const std::vector<bitLenInt> controls{ control };
1366 const std::vector<bitLenInt> controls{ control };
1382 const std::vector<bitLenInt> controls{ control };
1583 const std::vector<bitLenInt>& controls,
bitLenInt qubit,
const complex* matrix2x2,
bool antiCtrled =
false);
1717 #if ENABLE_REG_GATES
2144 INC(invToSub, start, length);
2153 const bool hasCarry =
M(carryIndex);
2156 INCDECC(toAdd + 1U, start, length, carryIndex);
2158 INCDECC(toAdd, start, length, carryIndex);
2165 const bool hasCarry =
M(carryIndex);
2173 INCDECC(invToSub, start, length, carryIndex);
2185 CINC(invToSub, inOutStart, length, controls);
2192 INC(signMask, start, length);
2193 INCDECC(toAdd & ~signMask, start, length, overflowIndex);
2195 DEC(signMask, start, length);
2203 INCS(invToSub, start, length, overflowIndex);
2216 bitLenInt length,
const std::vector<bitLenInt>& controls);
2220 bitLenInt length,
const std::vector<bitLenInt>& controls);
2232 CCNOT(inputBit1, inputBit2, carryOut);
2233 CNOT(inputBit1, inputBit2);
2234 CCNOT(inputBit2, carryInSumOut, carryOut);
2235 CNOT(inputBit2, carryInSumOut);
2236 CNOT(inputBit1, inputBit2);
2251 CNOT(inputBit1, inputBit2);
2252 CNOT(inputBit2, carryInSumOut);
2253 CCNOT(inputBit2, carryInSumOut, carryOut);
2254 CNOT(inputBit1, inputBit2);
2255 CCNOT(inputBit1, inputBit2, carryOut);
2326 virtual void QFTR(
const std::vector<bitLenInt>& qubits,
bool trySeparate =
false);
2342 virtual void IQFTR(
const std::vector<bitLenInt>& qubits,
bool trySeparate =
false);
2368 virtual bitCapInt M(
const std::vector<bitLenInt>& bits) {
return ForceM(bits, std::vector<bool>()); }
2371 virtual bitCapInt ForceM(
const std::vector<bitLenInt>& bits,
const std::vector<bool>& values,
bool doApply =
true);
2391 const std::vector<bitLenInt> controls{ qubit1 };
2404 return ISwap(qubit1, qubit2);
2409 return IISwap(qubit1, qubit2);
2417 CNOT(qubit1, qubit2);
2418 RZ(2 * theta, qubit2);
2419 CNOT(qubit1, qubit2);
2428 CNOT(qubit1, qubit2);
2429 RZ(2 * theta, qubit2);
2430 CNOT(qubit1, qubit2);
2440 while ((last > 0
U) && (first < (last - 1U))) {
2475 CNOT(control, target);
2477 CNOT(control, target);
2492 if (prob > highestProb) {
2497 if (highestProb > (
ONE_R1_F - totProb)) {
2546 virtual void ProbBitsAll(
const std::vector<bitLenInt>& bits,
real1* probsArray);
2566 bool roundRz,
const std::vector<bitLenInt>& bits,
const bitCapInt& offset =
ZERO_BCI)
2586 const std::vector<bitLenInt>& bits,
const std::vector<real1_f>& basisOps, std::vector<real1_f> eigenVals = {})
2598 const std::vector<std::shared_ptr<complex>>& basisOps, std::vector<real1_f> eigenVals = {})
2619 bool roundRz,
const std::vector<bitLenInt>& bits,
const std::vector<real1_f>& weights)
2631 const std::vector<bitLenInt>& bits,
const std::vector<bitCapInt>& perms,
const bitCapInt& offset =
ZERO_BCI);
2672 const std::vector<std::shared_ptr<complex>>& basisOps, std::vector<real1_f> eigenVals = {})
2684 const std::vector<bitLenInt>& bits,
const std::vector<real1_f>& basisOps, std::vector<real1_f> eigenVals = {})
2696 const std::vector<bitLenInt>& bits,
const std::vector<bitCapInt>& perms,
const bitCapInt& offset =
ZERO_BCI);
2718 const std::vector<bitLenInt>& bits,
const std::vector<real1_f>& weights);
2728 bool roundRz,
const std::vector<bitLenInt>& bits,
const std::vector<real1_f>& weights)
2751 return ProbMask(mask, permutation);
2760 bool roundRz,
const std::vector<bitLenInt>& bits,
const bitCapInt& offset =
ZERO_BCI)
2777 virtual std::map<bitCapInt, int>
MultiShotMeasureMask(
const std::vector<bitCapInt>& qPowers,
unsigned shots);
2785 const std::vector<bitCapInt>& qPowers,
unsigned shots,
unsigned long long* shotsArray);
2798 if (value !=
M(qubit)) {
3030 return (
real1_f)std::arg(amp);
void bi_or_ip(BigInteger *left, const BigInteger &right)
Definition: big_integer.hpp:444
void bi_increment(BigInteger *pBigInt, const BIG_INTEGER_WORD &value)
Definition: big_integer.hpp:220
int bi_compare_0(const BigInteger &left)
Definition: big_integer.hpp:140
Definition: parallel_for.hpp:19
void SetConcurrencyLevel(unsigned num)
Definition: parallel_for.hpp:28
A "Qrack::QInterface" is an abstract interface exposing qubit permutation state vector with methods t...
Definition: qinterface.hpp:141
virtual void GetQuantumState(complex *outputState)=0
Get the pure quantum state representation.
bitCapInt maxQPower
Definition: qinterface.hpp:149
void SetRandomSeed(uint32_t seed)
Definition: qinterface.hpp:261
virtual void SetConcurrency(uint32_t threadsPerEngine)
Set the number of threads in parallel for loops, per component QEngine.
Definition: qinterface.hpp:275
virtual bitCapInt GetAmplitudeCount()
Count of amplitudes, which might be less than state vector if sparse or compressed.
Definition: qinterface.hpp:284
real1 amplitudeFloor
Definition: qinterface.hpp:148
void MACWrapper(const std::vector< bitLenInt > &controls, Fn fn)
Definition: qinterface.hpp:179
bool useRDRAND
Definition: qinterface.hpp:145
virtual bitLenInt Allocate(bitLenInt length)
Allocate new "length" count of |0> state qubits at end of qubit index position.
Definition: qinterface.hpp:477
virtual bitCapInt GetMaxQPower()
Get the maximum number of basis states, namely for qubits.
Definition: qinterface.hpp:281
virtual void Copy(QInterfacePtr orig)
Definition: qinterface.hpp:222
virtual void Dispose(bitLenInt start, bitLenInt length, const bitCapInt &disposedPerm)=0
Dispose a a contiguous set of qubits that are already in a permutation eigenstate.
std::shared_ptr< RdRandom > hardware_rand_generator
Definition: qinterface.hpp:152
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 GetReducedDensityMatrix(const std::vector< bitLenInt > &qubits, complex *outputState)
Get a reduced density matrix on the list of qubits.
Definition: qinterface.cpp:853
virtual QInterfacePtr Decompose(bitLenInt start, bitLenInt length)=0
Schmidt decompose a length of qubits.
qrack_rand_gen_ptr rand_generator
Definition: qinterface.hpp:150
virtual bitLenInt ComposeNoClone(QInterfacePtr toCopy)
This is a variant of Compose() for a toCopy argument that will definitely not be reused once "Compose...
Definition: qinterface.hpp:376
bool randGlobalPhase
Definition: qinterface.hpp:144
virtual void SetPermutation(const bitCapInt &perm, const complex &phaseFac=CMPLX_DEFAULT_ARG)
Set to a specific permutation of all qubits.
Definition: qinterface.cpp:101
virtual void Decompose(bitLenInt start, QInterfacePtr dest)=0
Minimally decompose a set of contiguous bits from the separably composed unit, into "destination".
QInterface()
Default constructor, primarily for protected internal use.
Definition: qinterface.hpp:242
virtual void SetQubitCount(bitLenInt qb)
Definition: qinterface.hpp:268
std::uniform_real_distribution< real1_s > rand_distribution
Definition: qinterface.hpp:151
virtual void SetAmplitude(const bitCapInt &perm, const complex &)=0
Sets the representational amplitude of a full permutation.
virtual bitLenInt Allocate(bitLenInt start, bitLenInt length)=0
Allocate new "length" count of |0> state qubits at specified qubit index start position.
virtual void SetQuantumState(const complex *inputState)=0
Set an arbitrary pure quantum state representation.
virtual bitCapInt SampleClone(const std::vector< bitCapInt > &qPowers)
Definition: qinterface.hpp:191
static real1_f normHelper(const complex &c)
Definition: qinterface.hpp:156
static real1_f clampProb(real1_f toClamp)
Definition: qinterface.hpp:158
virtual real1_f ExpVarUnitaryAll(bool isExp, const std::vector< bitLenInt > &bits, const std::vector< std::shared_ptr< complex >> &basisOps, std::vector< real1_f > eigenVals={})
Definition: qinterface.cpp:476
bitLenInt qubitCount
Definition: qinterface.hpp:146
virtual bitLenInt GetQubitCount()
Get the count of bits in this register.
Definition: qinterface.hpp:278
uint32_t randomSeed
Definition: qinterface.hpp:147
real1_f Rand()
Generate a random real number between 0 and 1.
Definition: qinterface.hpp:289
virtual real1_f ExpVarBitsAll(bool isExp, const std::vector< bitLenInt > &bits, const bitCapInt &offset=ZERO_BCI)
Definition: qinterface.hpp:210
virtual void Dispose(bitLenInt start, bitLenInt length)=0
Minimally decompose a set of contiguous bits from the separably composed unit, and discard the separa...
virtual bool GetIsArbitraryGlobalPhase()
Definition: qinterface.hpp:286
bool doNormalize
Definition: qinterface.hpp:143
complex GetNonunitaryPhase()
Definition: qinterface.hpp:169
virtual ~QInterface()
Definition: qinterface.hpp:256
virtual void GetProbs(real1 *outputProbs)=0
Get the pure quantum state representation.
virtual complex GetAmplitude(const bitCapInt &perm)=0
Get the representational amplitude of a full permutation.
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 ASL(bitLenInt shift, bitLenInt start, bitLenInt length)
Arithmetic shift left, with last 2 bits as sign and carry.
Definition: qinterface.cpp:333
virtual void IFullAdd(bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt carryInSumOut, bitLenInt carryOut)
Inverse of FullAdd.
Definition: qinterface.hpp:2244
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 CADC(const std::vector< bitLenInt > &controls, bitLenInt input1, bitLenInt input2, bitLenInt output, bitLenInt length, bitLenInt carry)
Add a quantum integer to a quantum integer, with carry and with controls.
Definition: arithmetic.cpp:371
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 ADC(bitLenInt input1, bitLenInt input2, bitLenInt output, bitLenInt length, bitLenInt carry)
Add a quantum integer to a quantum integer, with carry.
Definition: arithmetic.cpp:330
virtual void DEC(const bitCapInt &toSub, bitLenInt start, bitLenInt length)
Subtract classical integer (without sign)
Definition: qinterface.hpp:2141
virtual void CFullAdd(const std::vector< bitLenInt > &controls, bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt carryInSumOut, bitLenInt carryOut)
Controlled quantum analog of classical "Full Adder" gate.
Definition: arithmetic.cpp:276
virtual void INC(const bitCapInt &toAdd, bitLenInt start, bitLenInt length)
Add integer (without sign)
Definition: arithmetic.cpp:20
virtual void LSR(bitLenInt shift, bitLenInt start, bitLenInt length)
Logical shift right, filling the extra bits with |0>
Definition: qinterface.cpp:384
virtual void FullAdd(bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt carryInSumOut, bitLenInt carryOut)
Quantum analog of classical "Full Adder" gate.
Definition: qinterface.hpp:2227
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 CIFullAdd(const std::vector< bitLenInt > &controls, bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt carryInSumOut, bitLenInt carryOut)
Inverse of CFullAdd.
Definition: arithmetic.cpp:302
virtual void CIADC(const std::vector< bitLenInt > &controls, bitLenInt input1, bitLenInt input2, bitLenInt output, bitLenInt length, bitLenInt carry)
Inverse of CADC.
Definition: arithmetic.cpp:392
virtual void ROL(bitLenInt shift, bitLenInt start, bitLenInt length)
Circular shift left - shift bits left, and carry last bits.
Definition: qinterface.cpp:295
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 IADC(bitLenInt input1, bitLenInt input2, bitLenInt output, bitLenInt length, bitLenInt carry)
Inverse of ADC.
Definition: arithmetic.cpp:350
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 ROR(bitLenInt shift, bitLenInt start, bitLenInt length)
Circular shift right - shift bits right, and carry first bits.
Definition: qinterface.cpp:314
virtual void LSL(bitLenInt shift, bitLenInt start, bitLenInt length)
Logical shift left, filling the extra bits with |0>
Definition: qinterface.cpp:369
virtual void ASR(bitLenInt shift, bitLenInt start, bitLenInt length)
Arithmetic shift right, with last 2 bits as sign and carry.
Definition: qinterface.cpp:351
virtual void ZMask(const bitCapInt &mask)
Masked Z gate.
Definition: gates.cpp:144
virtual void CPhaseRootN(bitLenInt n, bitLenInt control, bitLenInt target)
Controlled "PhaseRootN" gate.
Definition: qinterface.hpp:1328
virtual void CIPhaseRootN(bitLenInt n, bitLenInt control, bitLenInt target)
Controlled inverse "PhaseRootN" gate.
Definition: qinterface.hpp:1360
virtual void AntiCIAI(bitLenInt control, bitLenInt target, real1_f azimuth, real1_f inclination)
(Anti-)Controlled inverse "Azimuth, Inclination" (RY-RZ)
Definition: rotational.cpp:115
virtual void ISqrtX(bitLenInt qubit)
Inverse square root of X gate.
Definition: qinterface.hpp:1154
virtual void ISqrtY(bitLenInt qubit)
Inverse square root of Y gate.
Definition: qinterface.hpp:1184
virtual void CZ(bitLenInt control, bitLenInt target)
Controlled Z gate.
Definition: qinterface.hpp:785
virtual void CU(const std::vector< bitLenInt > &controls, bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
Controlled general unitary gate.
Definition: rotational.cpp:29
virtual void SH(bitLenInt qubit)
Y-basis transformation gate.
Definition: qinterface.hpp:950
virtual void AntiCS(bitLenInt control, bitLenInt target)
(Anti-)controlled S gate
Definition: qinterface.hpp:1268
virtual void CCZ(bitLenInt control1, bitLenInt control2, bitLenInt target)
Doubly-Controlled Z gate.
Definition: qinterface.hpp:808
virtual void UCPhase(const std::vector< bitLenInt > &controls, const complex &topLeft, const complex &bottomRight, bitLenInt target, const bitCapInt &perm)
Apply a single bit transformation that only effects phase, with arbitrary control bits,...
Definition: qinterface.hpp:598
virtual void CS(bitLenInt control, bitLenInt target)
Controlled S gate.
Definition: qinterface.hpp:1256
virtual void CIS(bitLenInt control, bitLenInt target)
Controlled inverse S gate.
Definition: qinterface.hpp:1280
virtual void SqrtY(bitLenInt qubit)
Square root of Y gate.
Definition: qinterface.hpp:1169
virtual void CNOT(bitLenInt control, bitLenInt target)
Controlled NOT gate.
Definition: qinterface.hpp:716
virtual void TimeEvolve(Hamiltonian h, real1_f timeDiff)
To define a Hamiltonian, give a vector of controlled single bit gates ("HamiltonianOp" instances) tha...
Definition: gates.cpp:426
virtual void SqrtW(bitLenInt qubit)
Square root of W gate.
Definition: qinterface.hpp:1197
virtual void IS(bitLenInt qubit)
Inverse S gate.
Definition: qinterface.hpp:1041
virtual 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: qinterface.hpp:502
virtual void S(bitLenInt qubit)
S gate.
Definition: qinterface.hpp:1034
virtual void CT(bitLenInt control, bitLenInt target)
Controlled T gate.
Definition: qinterface.hpp:1304
virtual void UniformlyControlledSingleBit(const std::vector< bitLenInt > &controls, bitLenInt qubit, const complex *mtrxs)
Apply a "uniformly controlled" arbitrary single bit unitary transformation.
Definition: qinterface.hpp:634
virtual void Y(bitLenInt qubit)
Y gate.
Definition: qinterface.hpp:1108
virtual bool ForceM(bitLenInt qubit, bool result, bool doForce=true, bool doApply=true)=0
Act as if is a measurement was applied, except force the (usually random) result.
virtual void CY(bitLenInt control, bitLenInt target)
Controlled Y gate.
Definition: qinterface.hpp:739
virtual void AntiCIPhaseRootN(bitLenInt n, bitLenInt control, bitLenInt target)
(Anti-)controlled inverse "PhaseRootN" gate
Definition: qinterface.hpp:1376
virtual void CH(bitLenInt control, bitLenInt target)
Controlled H gate.
Definition: qinterface.hpp:1226
virtual void AntiCAI(bitLenInt control, bitLenInt target, real1_f azimuth, real1_f inclination)
(Anti-)Controlled "Azimuth, Inclination" (RY-RZ)
Definition: rotational.cpp:103
virtual void H(bitLenInt qubit)
Hadamard gate.
Definition: qinterface.hpp:920
virtual void CIAI(bitLenInt control, bitLenInt target, real1_f azimuth, real1_f inclination)
Controlled inverse "Azimuth, Inclination" (RY-RZ)
Definition: rotational.cpp:89
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 AntiCSwap(const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
Apply a swap with arbitrary (anti) control bits.
Definition: gates.cpp:270
virtual void AI(bitLenInt target, real1_f azimuth, real1_f inclination)
"Azimuth, Inclination" (RY-RZ)
Definition: rotational.cpp:53
virtual void AntiCPhaseRootN(bitLenInt n, bitLenInt control, bitLenInt target)
(Anti-)controlled "PhaseRootN" gate
Definition: qinterface.hpp:1344
virtual void YMask(const bitCapInt &mask)
Masked Y gate.
Definition: gates.cpp:112
virtual void Mtrx(const complex *mtrx, bitLenInt qubit)=0
Apply an arbitrary single bit unitary transformation.
virtual void MACInvert(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: qinterface.hpp:586
virtual void UCMtrx(const std::vector< bitLenInt > &controls, const complex *mtrx, bitLenInt target, const bitCapInt &controlPerm)
Apply an arbitrary single bit unitary transformation, with arbitrary control bits,...
Definition: gates.cpp:23
virtual void HIS(bitLenInt qubit)
Y-basis (inverse) transformation gate.
Definition: qinterface.hpp:964
virtual void Phase(const complex &topLeft, const complex &bottomRight, bitLenInt qubit)
Apply a single bit transformation that only effects phase.
Definition: qinterface.hpp:523
virtual void Invert(const complex &topRight, const complex &bottomLeft, bitLenInt qubit)
Apply a single bit transformation that reverses bit probability and might effect phase.
Definition: qinterface.hpp:536
virtual void CAI(bitLenInt control, bitLenInt target, real1_f azimuth, real1_f inclination)
Controlled "Azimuth, Inclination" (RY-RZ)
Definition: rotational.cpp:77
virtual void CCY(bitLenInt control1, bitLenInt control2, bitLenInt target)
Doubly-Controlled Y gate.
Definition: qinterface.hpp:762
virtual void AntiCZ(bitLenInt control, bitLenInt target)
Anti controlled Z gate.
Definition: qinterface.hpp:796
virtual void AntiCU(const std::vector< bitLenInt > &controls, bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
(Anti-)Controlled general unitary gate
Definition: rotational.cpp:41
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 MACPhase(const std::vector< bitLenInt > &controls, const complex &topLeft, const complex &bottomRight, bitLenInt target)
Apply a single bit transformation that only effects phase, with arbitrary (anti-)control bits.
Definition: qinterface.hpp:570
virtual void U2(bitLenInt target, real1_f phi, real1_f lambda)
2-parameter unitary gate
Definition: qinterface.hpp:838
virtual void Z(bitLenInt qubit)
Z gate.
Definition: qinterface.hpp:1124
virtual void AntiCNOT(bitLenInt control, bitLenInt target)
Anti controlled NOT gate.
Definition: qinterface.hpp:727
virtual void AntiCY(bitLenInt control, bitLenInt target)
Anti controlled Y gate.
Definition: qinterface.hpp:750
virtual void ISqrtW(bitLenInt qubit)
Inverse square root of W gate.
Definition: qinterface.hpp:1211
virtual void PhaseParity(real1_f radians, const bitCapInt &mask)
Parity phase gate.
Definition: gates.cpp:399
virtual void IAI(bitLenInt target, real1_f azimuth, real1_f inclination)
Invert "Azimuth, Inclination" (RY-RZ)
Definition: rotational.cpp:64
virtual void AntiCISqrtSwap(const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
Apply an inverse square root of swap with arbitrary (anti) control bits.
Definition: gates.cpp:387
virtual void PhaseRootN(bitLenInt n, bitLenInt qubit)
"PhaseRootN" gate
Definition: qinterface.hpp:1062
virtual void U(bitLenInt target, real1_f theta, real1_f phi, real1_f lambda)
General unitary gate.
Definition: rotational.cpp:18
virtual void AntiCIS(bitLenInt control, bitLenInt target)
(Anti-)controlled inverse S gate
Definition: qinterface.hpp:1292
virtual void SqrtX(bitLenInt qubit)
Square root of X gate.
Definition: qinterface.hpp:1140
virtual void IU2(bitLenInt target, real1_f phi, real1_f lambda)
Inverse 2-parameter unitary gate.
Definition: qinterface.hpp:845
virtual void AntiCCNOT(bitLenInt control1, bitLenInt control2, bitLenInt target)
Anti doubly-controlled NOT gate.
Definition: qinterface.hpp:705
virtual void PhaseRootNMask(bitLenInt n, const bitCapInt &mask)
Masked PhaseRootN gate.
Definition: gates.cpp:155
virtual void SqrtH(bitLenInt qubit)
Square root of Hadamard gate.
Definition: qinterface.hpp:933
virtual 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: qinterface.hpp:545
virtual void AntiCCY(bitLenInt control1, bitLenInt control2, bitLenInt target)
Anti doubly-controlled Y gate.
Definition: qinterface.hpp:773
virtual bool M(bitLenInt qubit)
Measurement gate.
Definition: qinterface.hpp:1020
virtual 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: qinterface.hpp:560
virtual void AntiCSqrtSwap(const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
Apply a square root of swap with arbitrary (anti) control bits.
Definition: gates.cpp:375
virtual void MCMtrx(const std::vector< bitLenInt > &controls, const complex *mtrx, bitLenInt target)=0
Apply an arbitrary single bit unitary transformation, with arbitrary control bits.
virtual void CIT(bitLenInt control, bitLenInt target)
Controlled inverse T gate.
Definition: qinterface.hpp:1316
virtual void IT(bitLenInt qubit)
Inverse T gate.
Definition: qinterface.hpp:1055
virtual void AntiCCZ(bitLenInt control1, bitLenInt control2, bitLenInt target)
Anti doubly-controlled Z gate.
Definition: qinterface.hpp:819
virtual void CSwap(const std::vector< bitLenInt > &controls, bitLenInt qubit1, bitLenInt qubit2)
Apply a swap with arbitrary control bits.
Definition: gates.cpp:247
virtual void T(bitLenInt qubit)
T gate.
Definition: qinterface.hpp:1048
virtual void CCNOT(bitLenInt control1, bitLenInt control2, bitLenInt target)
Doubly-controlled NOT gate.
Definition: qinterface.hpp:694
virtual void XMask(const bitCapInt &mask)
Masked X gate.
Definition: gates.cpp:101
virtual void AntiCH(bitLenInt control, bitLenInt target)
(Anti-)controlled H gate
Definition: qinterface.hpp:1241
virtual void UCInvert(const std::vector< bitLenInt > &controls, const complex &topRight, const complex &bottomLeft, bitLenInt target, const bitCapInt &perm)
Apply a single bit transformation that reverses bit probability and might effect phase,...
Definition: qinterface.hpp:613
virtual void XOR(bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
Quantum analog of classical "XOR" gate.
Definition: logic.cpp:55
virtual void OR(bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
Quantum analog of classical "OR" gate.
Definition: logic.cpp:36
virtual void XNOR(bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
Quantum analog of classical "XNOR" gate.
Definition: logic.cpp:83
virtual void CLXNOR(bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
Quantum analog of classical "XNOR" gate.
Definition: logic.cpp:129
virtual void CLNAND(bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
Quantum analog of classical "NAND" gate.
Definition: logic.cpp:117
virtual void AND(bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
Quantum analog of classical "AND" gate.
Definition: logic.cpp:18
virtual void CLAND(bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
Quantum analog of classical "AND" gate.
Definition: logic.cpp:89
virtual void CLOR(bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
Quantum analog of classical "OR" gate.
Definition: logic.cpp:96
virtual void NAND(bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
Quantum analog of classical "NAND" gate.
Definition: logic.cpp:71
virtual void CLNOR(bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
Quantum analog of classical "NOR" gate.
Definition: logic.cpp:123
virtual void CLXOR(bitLenInt inputQBit, bool inputClassicalBit, bitLenInt outputBit)
Quantum analog of classical "XOR" gate.
Definition: logic.cpp:105
virtual void NOR(bitLenInt inputBit1, bitLenInt inputBit2, bitLenInt outputBit)
Quantum analog of classical "NOR" gate.
Definition: logic.cpp:77
virtual void X(bitLenInt start, bitLenInt length)
Bitwise Pauli X (or logical "NOT") operator.
Definition: qinterface.hpp:1715
virtual void H(bitLenInt start, bitLenInt length)
Bitwise Hadamard.
virtual void ExpZDyad(int numerator, int denomPower, bitLenInt qubit)
Dyadic fraction Pauli Z exponentiation gate.
Definition: qinterface.cpp:1301
virtual void RZDyad(int numerator, int denomPower, bitLenInt qubit)
Dyadic fraction Z axis rotation gate.
Definition: qinterface.cpp:1313
virtual void ExpX(real1_f radians, bitLenInt qubit)
Pauli X exponentiation gate.
Definition: rotational.cpp:248
virtual void CRTDyad(int numerator, int denomPower, bitLenInt control, bitLenInt target)
Controlled dyadic fraction "phase shift gate".
Definition: qinterface.cpp:1317
virtual void UniformlyControlledRZ(const std::vector< bitLenInt > &controls, bitLenInt qubit, const real1 *angles)
Apply a "uniformly controlled" rotation of a bit around the Pauli Z axis.
Definition: rotational.cpp:151
virtual void ExpDyad(int numerator, int denomPower, bitLenInt qubit)
Dyadic fraction (identity) exponentiation gate.
Definition: qinterface.cpp:1283
virtual void CRZDyad(int numerator, int denomPower, bitLenInt control, bitLenInt target)
Controlled dyadic fraction Z axis rotation gate.
Definition: qinterface.cpp:1335
virtual void RX(real1_f radians, bitLenInt qubit)
X axis rotation gate.
Definition: rotational.cpp:177
virtual void CRZ(real1_f radians, bitLenInt control, bitLenInt target)
Controlled Z axis rotation gate.
Definition: rotational.cpp:204
virtual void RYDyad(int numerator, int denomPower, bitLenInt qubit)
Dyadic fraction Y axis rotation gate.
Definition: qinterface.cpp:1310
virtual void UniformlyControlledRY(const std::vector< bitLenInt > &controls, bitLenInt qubit, const real1 *angles)
Apply a "uniformly controlled" rotation of a bit around the Pauli Y axis.
Definition: rotational.cpp:130
virtual void ExpY(real1_f radians, bitLenInt qubit)
Pauli Y exponentiation gate.
Definition: rotational.cpp:255
virtual void CRT(real1_f radians, bitLenInt control, bitLenInt target)
Controlled "phase shift gate".
Definition: rotational.cpp:269
virtual void CRY(real1_f radians, bitLenInt control, bitLenInt target)
Controlled Y axis rotation gate.
Definition: rotational.cpp:213
virtual void RY(real1_f radians, bitLenInt qubit)
Y axis rotation gate.
Definition: rotational.cpp:187
virtual void CRX(real1_f radians, bitLenInt control, bitLenInt target)
Controlled X axis rotation gate.
Definition: rotational.cpp:276
virtual void ExpYDyad(int numerator, int denomPower, bitLenInt qubit)
Dyadic fraction Pauli Y exponentiation gate.
Definition: qinterface.cpp:1295
virtual void RTDyad(int numerator, int denomPower, bitLenInt qubit)
Dyadic fraction phase shift gate.
Definition: qinterface.cpp:1280
virtual void RZ(real1_f radians, bitLenInt qubit)
Z axis rotation gate.
Definition: rotational.cpp:196
virtual void RT(real1_f radians, bitLenInt qubit)
Phase shift gate.
Definition: rotational.cpp:171
virtual void ExpZ(real1_f radians, bitLenInt qubit)
Pauli Z exponentiation gate.
Definition: rotational.cpp:262
virtual void CRYDyad(int numerator, int denomPower, bitLenInt control, bitLenInt target)
Controlled dyadic fraction y axis rotation gate.
Definition: qinterface.cpp:1329
virtual void RXDyad(int numerator, int denomPower, bitLenInt qubit)
Dyadic fraction X axis rotation gate.
Definition: qinterface.cpp:1307
virtual void ExpXDyad(int numerator, int denomPower, bitLenInt qubit)
Dyadic fraction Pauli X exponentiation gate.
Definition: qinterface.cpp:1289
virtual void Exp(real1_f radians, bitLenInt qubit)
(Identity) Exponentiation gate
Definition: rotational.cpp:225
virtual void CRXDyad(int numerator, int denomPower, bitLenInt control, bitLenInt target)
Controlled dyadic fraction X axis rotation gate.
Definition: qinterface.cpp:1323
virtual void Dump()
If asynchronous work is still running, let the simulator know that it can be aborted.
Definition: qinterface.hpp:2862
virtual bool isBinaryDecisionTree()
Returns "true" if current state representation is definitely a binary decision tree,...
Definition: qinterface.hpp:2868
virtual std::vector< int64_t > GetDeviceList()
Get the device index.
Definition: qinterface.hpp:3011
virtual void SetSparseAceMaxMb(size_t mb)
Set the (sparse-simulation) "automatic circuit elision" (ACE) maximum memory megabytes.
Definition: qinterface.hpp:2982
virtual real1_f VarianceBitsFactorized(const std::vector< bitLenInt > &bits, const std::vector< bitCapInt > &perms, const bitCapInt &offset=ZERO_BCI)
Get expectation value of bits, given an array of qubit weights.
Definition: qinterface.cpp:577
virtual real1_f ProbAllRdm(bool roundRz, const bitCapInt &fullRegister)
Direct measure of full permutation probability, treating all ancillary qubits as post-selected T gate...
Definition: qinterface.hpp:2741
virtual bool ApproxCompare(QInterfacePtr toCompare, real1_f error_tol=TRYDECOMPOSE_EPSILON)
Compare state vectors approximately, to determine whether this state vector is the same as the target...
Definition: qinterface.hpp:2809
virtual real1_f ExpectationBitsFactorizedRdm(bool roundRz, const std::vector< bitLenInt > &bits, const std::vector< bitCapInt > &perms, const bitCapInt &offset=ZERO_BCI)
Get (reduced density matrix) expectation value of bits, given an array of qubit weights.
Definition: qinterface.hpp:2705
virtual bool isClifford(bitLenInt qubit)
Returns "true" if current qubit state is identifiably within the Clifford set, or "false" if it is no...
Definition: qinterface.hpp:2880
virtual real1_f VarianceUnitaryAll(const std::vector< bitLenInt > &bits, const std::vector< std::shared_ptr< complex >> &basisOps, std::vector< real1_f > eigenVals={})
Direct measure of variance of listed (2x2 operator) single-qubit tensor product probability.
Definition: qinterface.hpp:2597
virtual real1_f VarianceUnitaryAll(const std::vector< bitLenInt > &bits, const std::vector< real1_f > &basisOps, std::vector< real1_f > eigenVals={})
Direct measure of variance of listed (3-parameter) single-qubit tensor product probability.
Definition: qinterface.hpp:2585
virtual real1_f FirstNonzeroPhase()
Get phase of lowest permutation nonzero amplitude.
Definition: qinterface.hpp:3021
virtual real1_f VarianceFloatsFactorized(const std::vector< bitLenInt > &bits, const std::vector< real1_f > &weights)
Direct measure of variance of listed bit string probability.
Definition: qinterface.cpp:618
virtual real1_f VarianceBitsFactorizedRdm(bool roundRz, const std::vector< bitLenInt > &bits, const std::vector< bitCapInt > &perms, const bitCapInt &offset=ZERO_BCI)
Get (reduced density matrix) expectation value of bits, given an array of qubit weights.
Definition: qinterface.hpp:2640
virtual real1_f ExpectationUnitaryAll(const std::vector< bitLenInt > &bits, const std::vector< real1_f > &basisOps, std::vector< real1_f > eigenVals={})
Get single-qubit (3-parameter) tensor product (arbitrary real) observable.
Definition: qinterface.hpp:2683
virtual real1_f CProb(bitLenInt control, bitLenInt target)
Direct measure of bit probability to be in |1> state, if control bit is |1>.
Definition: qinterface.hpp:2462
virtual double GetUnitaryFidelity()
When "Schmidt-decomposition rounding parameter" ("SDRP") is being used, starting from initial 1....
Definition: qinterface.hpp:2918
virtual void SetSdrp(real1_f sdrp)
Set the "Schmidt decomposition rounding parameter" value, (between 0 and 1)
Definition: qinterface.hpp:2926
virtual bool TrySeparate(bitLenInt qubit1, bitLenInt qubit2)
Two-qubit TrySeparate()
Definition: qinterface.hpp:2908
virtual bool isClifford()
Returns "true" if current state is identifiably within the Clifford set, or "false" if it is not or c...
Definition: qinterface.hpp:2874
virtual real1_f ProbAll(const bitCapInt &fullRegister)
Direct measure of full permutation probability.
Definition: qinterface.hpp:2513
virtual void ProbMaskAll(const bitCapInt &mask, real1 *probsArray)
Direct measure of masked permutation probability.
Definition: qinterface.cpp:421
virtual QInterfacePtr Clone()=0
Clone this QInterface.
virtual real1_f ACProb(bitLenInt control, bitLenInt target)
Direct measure of bit probability to be in |1> state, if control bit is |0>.
Definition: qinterface.hpp:2473
virtual real1_f VariancePauliAll(std::vector< bitLenInt > bits, std::vector< Pauli > paulis)
Direct measure of variance of listed Pauli tensor product probability.
Definition: qinterface.cpp:657
virtual void Finish()
If asynchronous work is still running, block until it finishes.
Definition: qinterface.hpp:2850
virtual bool GetReactiveSeparate()
Get reactive separation option.
Definition: qinterface.hpp:2946
virtual QInterfacePtr Copy()
Copy this QInterface.
Definition: qinterface.hpp:2992
virtual real1_f ExpectationBitsAll(const std::vector< bitLenInt > &bits, const bitCapInt &offset=ZERO_BCI)
Get permutation expectation value of bits.
Definition: qinterface.hpp:2652
virtual real1_f Prob(bitLenInt qubit)=0
Direct measure of bit probability to be in |1> state.
virtual std::map< bitCapInt, int > MultiShotMeasureMask(const std::vector< bitCapInt > &qPowers, unsigned shots)
Statistical measure of masked permutation probability.
Definition: qinterface.cpp:805
virtual void SetTInjection(bool useGadget)
Set the option to use T-injection gadgets (off by default)
Definition: qinterface.hpp:2954
virtual real1_f VarianceFloatsFactorizedRdm(bool roundRz, const std::vector< bitLenInt > &bits, const std::vector< real1_f > &weights)
Direct measure of (reduced density matrix) variance of bits, given an array of qubit weights.
Definition: qinterface.hpp:2618
virtual void ResetUnitaryFidelity()
Reset the internal fidelity calculation tracker to 1.0.
Definition: qinterface.hpp:2922
virtual bool TryDecompose(bitLenInt start, QInterfacePtr dest, real1_f error_tol=TRYDECOMPOSE_EPSILON)
Attempt to Decompose() a bit range.
Definition: qinterface.cpp:834
virtual real1_f GetNoiseParameter()
Get the noise level option (only for a noisy interface)
Definition: qinterface.hpp:2974
virtual void ProbBitsAll(const std::vector< bitLenInt > &bits, real1 *probsArray)
Direct measure of listed permutation probability.
Definition: qinterface.cpp:444
virtual real1_f ProbRdm(bitLenInt qubit)
Direct measure of bit probability to be in |1> state, treating all ancillary qubits as post-selected ...
Definition: qinterface.hpp:2737
bitCapIntOcl GetMaxSize()
Get maximum number of amplitudes that can be allocated on current device.
Definition: qinterface.hpp:3016
virtual bool GetTInjection()
Get the option to use T-injection gadgets.
Definition: qinterface.hpp:2962
virtual void SetDeviceList(std::vector< int64_t > dIDs)
Set the device index list, if more than one device is available.
Definition: qinterface.hpp:3006
virtual real1_f ProbMask(const bitCapInt &mask, const bitCapInt &permutation)
Direct measure of masked permutation probability.
Definition: qinterface.cpp:278
virtual real1_f ExpectationPauliAll(std::vector< bitLenInt > bits, std::vector< Pauli > paulis)
Get Pauli tensor product observable.
Definition: qinterface.cpp:713
virtual void SetReactiveSeparate(bool isAggSep)
Set reactive separation option (on by default if available)
Definition: qinterface.hpp:2938
virtual void UpdateRunningNorm(real1_f norm_thresh=REAL1_DEFAULT_ARG)=0
Force a calculation of the norm of the state vector, in order to make it unit length before the next ...
virtual real1_f VarianceBitsAll(const std::vector< bitLenInt > &bits, const bitCapInt &offset=ZERO_BCI)
Direct measure of variance of listed permutation probability.
Definition: qinterface.hpp:2554
virtual real1_f ExpectationBitsFactorized(const std::vector< bitLenInt > &bits, const std::vector< bitCapInt > &perms, const bitCapInt &offset=ZERO_BCI)
Get expectation value of bits, given an array of qubit weights.
Definition: qinterface.cpp:540
virtual real1_f ProbMaskRdm(bool roundRz, const bitCapInt &mask, const bitCapInt &permutation)
Direct measure of masked permutation probability, treating all ancillary qubits as post-selected T ga...
Definition: qinterface.hpp:2749
virtual void SetNcrp(real1_f ncrp)
Set the "Near-clifford rounding parameter" value, (between 0 and 1)
Definition: qinterface.hpp:2930
virtual void SetDevice(int64_t dID)
Set the device index, if more than one device is available.
Definition: qinterface.hpp:2997
virtual void DepolarizingChannelWeak1Qb(bitLenInt qubit, real1_f lambda)
Simulate a local qubit depolarizing noise channel, under a stochastic "weak simulation condition....
Definition: gates.cpp:487
virtual bool isOpenCL()
Returns "true" if current simulation is OpenCL-based.
Definition: qinterface.hpp:2885
virtual real1_f ExpectationFloatsFactorized(const std::vector< bitLenInt > &bits, const std::vector< real1_f > &weights)
Get expectation value of bits, given a (floating-point) array of qubit weights.
Definition: qinterface.cpp:769
virtual real1_f ProbReg(bitLenInt start, bitLenInt length, const bitCapInt &permutation)
Direct measure of register permutation probability.
Definition: qinterface.cpp:262
virtual int64_t GetDevice()
Get the device index.
Definition: qinterface.hpp:3002
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
virtual void SetAceMaxQubits(bitLenInt qb)
Set the "automatic circuit elision" (ACE) maximum entangled subsystem qubit count.
Definition: qinterface.hpp:2978
virtual real1_f SumSqrDiff(QInterfacePtr toCompare)=0
Calculates (1 - <\psi_e|\psi_c>) between states |\psi_c> and |\psi_e>.
virtual void SetBit(bitLenInt qubit, bool value)
Set individual bit to pure |0> (false) or |1> (true) state.
Definition: qinterface.hpp:2796
virtual real1_f ExpectationBitsAllRdm(bool roundRz, const std::vector< bitLenInt > &bits, const bitCapInt &offset=ZERO_BCI)
Get permutation expectation value of bits, treating all ancillary qubits as post-selected T gate gadg...
Definition: qinterface.hpp:2759
virtual void NormalizeState(real1_f nrm=REAL1_DEFAULT_ARG, real1_f norm_thresh=REAL1_DEFAULT_ARG, real1_f phaseArg=ZERO_R1_F)=0
Apply the normalization factor found by UpdateRunningNorm() or on the fly by a single bit gate.
virtual real1_f ExpectationFloatsFactorizedRdm(bool roundRz, const std::vector< bitLenInt > &bits, const std::vector< real1_f > &weights)
Get (reduced density matrix) expectation value of bits, given a (floating-point) array of qubit weigh...
Definition: qinterface.hpp:2727
virtual real1_f VarianceBitsAllRdm(bool roundRz, const std::vector< bitLenInt > &bits, const bitCapInt &offset=ZERO_BCI)
Direct measure of (reduced density matrix) variance of listed permutation probability.
Definition: qinterface.hpp:2565
virtual bitCapInt HighestProbAll()
Get highest probability permutation.
Definition: qinterface.hpp:2485
virtual real1_f ExpectationUnitaryAll(const std::vector< bitLenInt > &bits, const std::vector< std::shared_ptr< complex >> &basisOps, std::vector< real1_f > eigenVals={})
Get single-qubit tensor product (arbitrary real) observable.
Definition: qinterface.hpp:2671
virtual bool TrySeparate(bitLenInt qubit)
Single-qubit TrySeparate()
Definition: qinterface.hpp:2904
virtual void SetNoiseParameter(real1_f lambda)
Set the noise level option (only for a noisy interface)
Definition: qinterface.hpp:2968
virtual bool isFinished()
Returns "false" if asynchronous work is still running, and "true" if all previously dispatched asynch...
Definition: qinterface.hpp:2856
GLOSSARY: bitLenInt - "bit-length integer" - unsigned integer ID of qubit position in register bitCap...
Definition: complex16x2simd.hpp:25
bitCapInt bitRegMask(const bitLenInt &start, const bitLenInt &length)
Definition: qrack_functions.hpp:157
QRACK_CONST real1 SQRT1_2_R1
Definition: qrack_types.hpp:188
QInterfaceEngine
Enumerated list of supported engines.
Definition: qinterface.hpp:37
@ QINTERFACE_OPTIMAL_BASE
Definition: qinterface.hpp:124
@ QINTERFACE_QPAGER
Create a QPager, which breaks up the work of a QEngine into equally sized "pages.".
Definition: qinterface.hpp:82
@ QINTERFACE_OPTIMAL_SCHROEDINGER
Definition: qinterface.hpp:122
@ QINTERFACE_OPTIMAL_MULTI
Definition: qinterface.hpp:129
@ QINTERFACE_CUDA
Create a QEngineCUDA, leveraging CUDA hardware to increase the speed of certain calculations.
Definition: qinterface.hpp:52
@ QINTERFACE_STABILIZER_HYBRID
Create a QStabilizerHybrid, switching between a QStabilizer and a QHybrid as efficient.
Definition: qinterface.hpp:77
@ QINTERFACE_HYBRID
Create a QHybrid, switching between QEngineCPU and QEngineOCL as efficient.
Definition: qinterface.hpp:57
@ QINTERFACE_OPTIMAL
Definition: qinterface.hpp:127
@ QINTERFACE_BDT_HYBRID
Create a QBinaryDecisionTree, (CPU-based).
Definition: qinterface.hpp:67
@ QINTERFACE_BDT
Create a QBinaryDecisionTree, (CPU-based).
Definition: qinterface.hpp:62
@ QINTERFACE_TENSOR_NETWORK
Circuit-simplification layer.
Definition: qinterface.hpp:107
@ QINTERFACE_NOISY
Noisy wrapper layer.
Definition: qinterface.hpp:112
@ QINTERFACE_QUNIT_CLIFFORD
Clifford-specialized QUnit.
Definition: qinterface.hpp:102
@ QINTERFACE_OPENCL
Create a QEngineOCL, leveraging OpenCL hardware to increase the speed of certain calculations.
Definition: qinterface.hpp:47
@ QINTERFACE_STABILIZER
Create a QStabilizer, limited to Clifford/Pauli operations, but efficient.
Definition: qinterface.hpp:72
@ QINTERFACE_QUNIT
Create a QUnit, which utilizes other QInterface classes to minimize the amount of work that's needed ...
Definition: qinterface.hpp:91
@ QINTERFACE_QUNIT_MULTI
Create a QUnitMulti, which distributes the explicitly separated "shards" of a QUnit across available ...
Definition: qinterface.hpp:97
@ QINTERFACE_MAX
Definition: qinterface.hpp:131
@ QINTERFACE_CPU
Create a QEngineCPU leveraging only local CPU and memory resources.
Definition: qinterface.hpp:42
std::shared_ptr< QInterface > QInterfacePtr
Definition: qinterface.hpp:29
QRACK_CONST real1 SQRT2_R1
Definition: qrack_types.hpp:187
QRACK_CONST real1_f TRYDECOMPOSE_EPSILON
Definition: qrack_types.hpp:270
QRACK_CONST complex C_SQRT1_2_NEG
Definition: gates.cpp:21
void seed(quid sid, unsigned s)
"Seed" random number generator (if pseudo-random Mersenne twister is in use)
Definition: wasm_api.cpp:873
half_float::half real1
Definition: qrack_types.hpp:102
std::complex< real1 > complex
Definition: qrack_types.hpp:136
QRACK_CONST real1 FP_NORM_EPSILON
Definition: qrack_types.hpp:268
bitCapInt pow2(const bitLenInt &p)
Definition: qrack_functions.hpp:143
double norm(const complex2 &c)
Definition: complex16x2simd.hpp:122
QRACK_CONST real1 REAL1_EPSILON
Definition: qrack_types.hpp:208
QRACK_CONST complex ONE_CMPLX
Definition: qrack_types.hpp:262
QRACK_CONST real1 ONE_R1
Definition: qrack_types.hpp:193
std::vector< HamiltonianOpPtr > Hamiltonian
Definition: hamiltonian.hpp:120
QRACK_CONST real1 ZERO_R1
Definition: qrack_types.hpp:191
float real1_f
Definition: qrack_types.hpp:103
QRACK_CONST complex CMPLX_DEFAULT_ARG
Definition: qrack_types.hpp:267
QRACK_CONST complex I_CMPLX
Definition: qrack_types.hpp:264
QRACK_CONST complex C_SQRT1_2
Definition: gates.cpp:17
QRACK_CONST complex ZERO_CMPLX
Definition: qrack_types.hpp:263
QRACK_CONST real1 PI_R1
Definition: qrack_types.hpp:186
const bitCapInt ONE_BCI
Definition: qrack_types.hpp:137
const bitCapInt ZERO_BCI
Definition: qrack_types.hpp:138
bitCapIntOcl pow2Ocl(const bitLenInt &p)
Definition: qrack_functions.hpp:144
HALF_CONSTEXPR half abs(half arg)
Absolute value.
Definition: half.hpp:2975
half sin(half arg)
Sine function.
Definition: half.hpp:3885
half cos(half arg)
Cosine function.
Definition: half.hpp:3922
half pow(half x, half y)
Power function.
Definition: half.hpp:3738
half exp(half arg)
Exponential function.
Definition: half.hpp:3201
#define REAL1_DEFAULT_ARG
Definition: qrack_types.hpp:185
#define QRACK_CONST
Definition: qrack_types.hpp:182
#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
#define ONE_R1_F
Definition: qrack_types.hpp:171
#define IS_NORM_0(c)
Definition: qrack_types.hpp:29
#define C_I_SQRT1_2
Definition: qunitclifford.cpp:412