Qrack  9.0
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
 

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.size()) { \
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:64

◆ CHECK_SHOTS

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

◆ 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:1622

◆ 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:63

◆ 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())] = (unsigned)d; \
} \
} \
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); \
std::shuffle(shotsArray, shotsArray + shots, std::default_random_engine(seed)); \
stateMapCache.clear();
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:1362
MICROSOFT_QUANTUM_DECL void seed(_In_ uintq sid, _In_ uintq s)
(External API) Set RNG seed for simulator ID
Definition: pinvoke_api.cpp:922

◆ FILL_REMAINING_MAP_SHOTS

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

◆ FIX_OVERPROB_SHOT_AND_FINISH

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

◆ 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:28
#define IS_CLIFFORD_PHASE_INVERT(top, bottom)
Definition: qstabilizerhybrid.cpp:19
#define IS_INVERT(mtrx)
Definition: qstabilizerhybrid.cpp:31
#define IS_PHASE(mtrx)
Definition: qstabilizerhybrid.cpp:30

◆ 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)