Qrack  9.9
General classical-emulating-quantum development framework
Namespaces | Macros | Functions
qstabilizerhybrid.cpp File Reference
#include "qfactory.hpp"
#include <iomanip>
#include <thread>
Include dependency graph for qstabilizerhybrid.cpp:

Namespaces

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

Macros

#define IS_REAL_1(r)   (abs(ONE_R1 - r) <= FP_NORM_EPSILON)
 
#define IS_CTRLED_CLIFFORD(top, bottom)    ((IS_REAL_1(std::real(top)) || IS_REAL_1(std::imag(bottom))) && (IS_SAME(top, bottom) || IS_SAME(top, -bottom)))
 
#define IS_CLIFFORD_PHASE_INVERT(top, bottom)    (IS_SAME(top, bottom) || IS_SAME(top, -bottom) || IS_SAME(top, I_CMPLX * bottom) || IS_SAME(top, -I_CMPLX * bottom))
 
#define IS_CLIFFORD(mtrx)
 
#define IS_PHASE(mtrx)   (IS_NORM_0(mtrx[1U]) && IS_NORM_0(mtrx[2U]))
 
#define IS_INVERT(mtrx)   (IS_NORM_0(mtrx[0U]) && IS_NORM_0(mtrx[3U]))
 
#define ADD_SHOT_PROB(m)
 
#define CHECK_NARROW_SHOT()
 
#define CHECK_WIDE_SHOT(j, k)
 
#define FIX_OVERPROB_SHOT_AND_FINISH()
 
#define FILL_REMAINING_MAP_SHOTS()
 
#define ADD_SHOTS_PROB(m)
 
#define CHECK_SHOTS(m, lm)
 
#define CHECK_SHOTS_IF_ANY(m, lm)
 
#define FILL_REMAINING_ARRAY_SHOTS()
 

Functions

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

Macro Definition Documentation

◆ ADD_SHOT_PROB

#define ADD_SHOT_PROB (   m)
Value:
if (prob > FP_NORM_EPSILON) { \
d = (m); \
} \
partProb += prob;
QRACK_CONST real1 FP_NORM_EPSILON
Definition: qrack_types.hpp:243

◆ ADD_SHOTS_PROB

#define ADD_SHOTS_PROB (   m)
Value:
if (rng.empty()) { \
continue; \
} \
ADD_SHOT_PROB(m)

◆ CHECK_NARROW_SHOT

#define CHECK_NARROW_SHOT ( )
Value:
const real1_f prob = norm(GetAmplitude(m)); \
ADD_SHOT_PROB(m) \
if (resProb < partProb) { \
foundM = true; \
break; \
}
double norm(const complex2 &c)
Definition: complex16x2simd.hpp:101
float real1_f
Definition: qrack_types.hpp:91

◆ CHECK_SHOTS

#define CHECK_SHOTS (   m,
  lm 
)
Value:
CheckShots(shots, m, partProb, qPowers, rng, lm);
#define ADD_SHOT_PROB(m)
Definition: qstabilizerhybrid.cpp:1546

◆ CHECK_SHOTS_IF_ANY

#define CHECK_SHOTS_IF_ANY (   m,
  lm 
)
Value:
CheckShots(shots, m, partProb, qPowers, rng, lm);
#define ADD_SHOTS_PROB(m)
Definition: qstabilizerhybrid.cpp:1670

◆ CHECK_WIDE_SHOT

#define CHECK_WIDE_SHOT (   j,
 
)
Value:
const real1 prob = futures[j].get(); \
if (foundM) { \
continue; \
} \
ADD_SHOT_PROB(k) \
if (resProb < partProb) { \
m = (k); \
foundM = true; \
}
half_float::half real1
Definition: qrack_types.hpp:90

◆ FILL_REMAINING_ARRAY_SHOTS

#define FILL_REMAINING_ARRAY_SHOTS ( )
Value:
if (rng.size()) { \
for (unsigned shot = 0U; shot < rng.size(); ++shot) { \
shotsArray[shot + (shots - rng.size())] = (bitCapIntOcl)d; \
} \
} \
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); \
std::shuffle(shotsArray, shotsArray + shots, std::default_random_engine(seed)); \
stateMapCache = NULL;
MICROSOFT_QUANTUM_DECL void U(_In_ uintq sid, _In_ uintq q, _In_ double theta, _In_ double phi, _In_ double lambda)
(External API) 3-parameter unitary gate
Definition: pinvoke_api.cpp:1504
MICROSOFT_QUANTUM_DECL void seed(_In_ uintq sid, _In_ uintq s)
(External API) Set RNG seed for simulator ID
Definition: pinvoke_api.cpp:928
#define bitCapIntOcl
Definition: qrack_types.hpp:50

◆ FILL_REMAINING_MAP_SHOTS

#define FILL_REMAINING_MAP_SHOTS ( )
Value:
if (rng.size()) { \
results[d] += shots - rng.size(); \
} \
stateMapCache = NULL;

◆ FIX_OVERPROB_SHOT_AND_FINISH

#define FIX_OVERPROB_SHOT_AND_FINISH ( )
Value:
if (!foundM) { \
m = d; \
} \
SetPermutation(m); \
stateMapCache = NULL;

◆ IS_CLIFFORD

#define IS_CLIFFORD (   mtrx)
Value:
((IS_PHASE(mtrx) && IS_CLIFFORD_PHASE_INVERT(mtrx[0], mtrx[3])) || \
(IS_INVERT(mtrx) && IS_CLIFFORD_PHASE_INVERT(mtrx[1], mtrx[2])) || \
((IS_SAME(mtrx[0U], mtrx[1U]) || IS_SAME(mtrx[0U], -mtrx[1U]) || IS_SAME(mtrx[0U], I_CMPLX * mtrx[1U]) || \
IS_SAME(mtrx[0U], -I_CMPLX * mtrx[1U])) && \
(IS_SAME(mtrx[0U], mtrx[2U]) || IS_SAME(mtrx[0U], -mtrx[2U]) || IS_SAME(mtrx[0U], I_CMPLX * mtrx[2U]) || \
IS_SAME(mtrx[0U], -I_CMPLX * mtrx[2U])) && \
(IS_SAME(mtrx[0U], mtrx[3U]) || IS_SAME(mtrx[0U], -mtrx[3U]) || IS_SAME(mtrx[0U], I_CMPLX * mtrx[3U]) || \
IS_SAME(mtrx[0U], -I_CMPLX * mtrx[3U]))))
QRACK_CONST complex I_CMPLX
Definition: qrack_types.hpp:241
#define IS_SAME(c1, c2)
Definition: qrack_types.hpp:26
#define IS_CLIFFORD_PHASE_INVERT(top, bottom)
Definition: qstabilizerhybrid.cpp:27
#define IS_INVERT(mtrx)
Definition: qstabilizerhybrid.cpp:39
#define IS_PHASE(mtrx)
Definition: qstabilizerhybrid.cpp:38

◆ IS_CLIFFORD_PHASE_INVERT

#define IS_CLIFFORD_PHASE_INVERT (   top,
  bottom 
)     (IS_SAME(top, bottom) || IS_SAME(top, -bottom) || IS_SAME(top, I_CMPLX * bottom) || IS_SAME(top, -I_CMPLX * bottom))

◆ IS_CTRLED_CLIFFORD

#define IS_CTRLED_CLIFFORD (   top,
  bottom 
)     ((IS_REAL_1(std::real(top)) || IS_REAL_1(std::imag(bottom))) && (IS_SAME(top, bottom) || IS_SAME(top, -bottom)))

◆ IS_INVERT

#define IS_INVERT (   mtrx)    (IS_NORM_0(mtrx[0U]) && IS_NORM_0(mtrx[3U]))

◆ IS_PHASE

#define IS_PHASE (   mtrx)    (IS_NORM_0(mtrx[1U]) && IS_NORM_0(mtrx[2U]))

◆ IS_REAL_1

#define IS_REAL_1 (   r)    (abs(ONE_R1 - r) <= FP_NORM_EPSILON)