17 #define _USE_MATH_DEFINES
27 #define IS_NORM_0(c) (norm(c) <= FP_NORM_EPSILON)
28 #define IS_SAME(c1, c2) (IS_NORM_0((c1) - (c2)))
29 #define IS_OPPOSITE(c1, c2) (IS_NORM_0((c1) + (c2)))
31 #if QBCAPPOW > 6 && defined(BOOST_AVAILABLE) || QBCAPPOW > 7
32 #include <boost/multiprecision/cpp_int.hpp>
36 #include <cuda_runtime.h>
39 #if (FPPOW < 5) && !defined(__arm__)
44 #define bitLenInt uint8_t
46 #define bitLenInt uint16_t
48 #define bitLenInt uint32_t
50 #define bitLenInt uint64_t
56 typedef std::complex<__fp16>
complex;
62 typedef std::complex<half_float::half>
complex;
69 typedef std::complex<float>
complex;
75 typedef std::complex<double>
complex;
80 #include <boost/multiprecision/float128.hpp>
83 typedef std::complex<boost::multiprecision::float128>
complex;
84 typedef boost::multiprecision::float128
real1;
85 typedef boost::multiprecision::float128
real1_f;
91 #define bitCapIntOcl uint8_t
93 constexpr uint16_t
ONE_BCI = 1U;
94 #define bitCapIntOcl uint16_t
97 #define bitCapIntOcl uint32_t
100 #define bitCapIntOcl uint64_t
105 #define bitCapInt uint32_t
108 #define bitCapInt uint64_t
110 #define bitsInCap 128
111 #ifdef BOOST_AVAILABLE
112 #define bitCapInt boost::multiprecision::uint128_t
114 #define bitCapInt __uint128_t
119 boost::multiprecision::number<boost::multiprecision::cpp_int_backend<1ULL << QBCAPPOW, 1ULL << QBCAPPOW, \
120 boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>
123 typedef std::shared_ptr<complex>
BitOp;
144 #define bitsInByte 8U
145 #define qrack_rand_gen std::mt19937_64
146 #define qrack_rand_gen_ptr std::shared_ptr<qrack_rand_gen>
147 #define QRACK_ALIGN_SIZE 64U
150 #define QRACK_CONST const
162 #define QRACK_CONST constexpr
164 #define ZERO_R1_F 0.0f
166 #define ONE_R1_F 1.0f
170 #define REAL1_DEFAULT_ARG -999.0f
172 #define REAL1_EPSILON 1.1641532e-10
174 #define QRACK_CONST constexpr
176 #define ZERO_R1_F 0.0
180 #define SQRT2_R1 M_SQRT2
181 #define SQRT1_2_R1 M_SQRT1_2
182 #define REAL1_DEFAULT_ARG -999.0
184 #define REAL1_EPSILON 2.7105054e-20
186 #define QRACK_CONST constexpr
188 #define ZERO_R1_F 0.0
194 #define REAL1_DEFAULT_ARG -999.0
196 #define REAL1_EPSILON 1.4693679e-39
201 #include <cuda_fp16.h>
202 #define qCudaReal1 __half
203 #define qCudaReal2 __half2
204 #define qCudaReal4 __half2*
205 #define qCudaCmplx __half2
206 #define qCudaCmplx2 __half2*
207 #define qCudaReal1_f float
208 #define make_qCudaCmplx make_half2
209 #define ZERO_R1_CUDA ((qCudaReal1)0.0f)
210 #define REAL1_EPSILON_CUDA 0.00000762939f
211 #define PI_R1_CUDA M_PI
213 #define qCudaReal1 float
214 #define qCudaReal2 float2
215 #define qCudaReal4 float4
216 #define qCudaCmplx float2
217 #define qCudaCmplx2 float4
218 #define qCudaReal1_f float
219 #define make_qCudaCmplx make_float2
220 #define make_qCudaCmplx2 make_float4
221 #define ZERO_R1_CUDA 0.0f
222 #define REAL1_EPSILON_CUDA REAL1_EPSILON
223 #define PI_R1_CUDA PI_R1
225 #define qCudaReal1 double
226 #define qCudaReal2 double2
227 #define qCudaReal4 double4
228 #define qCudaCmplx double2
229 #define qCudaCmplx2 double4
230 #define qCudaReal1_f double
231 #define make_qCudaCmplx make_double2
232 #define make_qCudaCmplx2 make_double4
233 #define ZERO_R1_CUDA 0.0
234 #define REAL1_EPSILON_CUDA REAL1_EPSILON
235 #define PI_R1_CUDA PI_R1
Abstract QEngine implementation, for all "Schroedinger method" engines.
Definition: qengine.hpp:31
Definition: statevector.hpp:83
Definition: statevector.hpp:211
Definition: statevector.hpp:45
Half-precision floating-point type.
Definition: half.hpp:2222
Main header file for half-precision functionality.
Definition: complex16x2simd.hpp:25
constexpr uint8_t ONE_BCI
Definition: qrack_types.hpp:90
std::complex< half_float::half > complex
Definition: qrack_types.hpp:62
std::shared_ptr< QEngine > QEnginePtr
Definition: qrack_types.hpp:141
QRACK_CONST real1_f TRYDECOMPOSE_EPSILON
Definition: qrack_types.hpp:244
constexpr real1_f ZERO_R1_F
Definition: qrack_types.hpp:152
constexpr real1_f FP_NORM_EPSILON_F
Definition: qrack_types.hpp:245
std::shared_ptr< complex > BitOp
Definition: qrack_types.hpp:123
const real1 ONE_R1
Definition: qrack_types.hpp:153
std::function< bitCapIntOcl(const bitCapIntOcl &)> IncrementFunc
Definition: qrack_types.hpp:127
constexpr real1_f ONE_R1_F
Definition: qrack_types.hpp:154
std::function< bitCapInt(const bitCapInt &)> BdtFunc
Definition: qrack_types.hpp:128
std::function< void(void)> DispatchFn
Definition: dispatchqueue.hpp:31
half_float::half real1
Definition: qrack_types.hpp:63
QRACK_CONST real1 FP_NORM_EPSILON
Definition: qrack_types.hpp:243
const real1 SQRT2_R1
Definition: qrack_types.hpp:159
std::shared_ptr< StateVectorSparse > StateVectorSparsePtr
Definition: qrack_types.hpp:137
std::function< void(const bitCapInt &, const unsigned &cpu)> ParallelFuncBdt
Definition: qrack_types.hpp:129
const real1 REAL1_DEFAULT_ARG
Definition: qrack_types.hpp:155
const real1 PI_R1
Definition: qrack_types.hpp:158
QRACK_CONST complex ONE_CMPLX
Definition: qrack_types.hpp:239
const real1 ZERO_R1
Definition: qrack_types.hpp:151
float real1_f
Definition: qrack_types.hpp:64
std::shared_ptr< StateVectorArray > StateVectorArrayPtr
Definition: qrack_types.hpp:136
float real1_s
Definition: qrack_types.hpp:65
QRACK_CONST complex CMPLX_DEFAULT_ARG
Definition: qrack_types.hpp:242
std::function< void(const bitCapIntOcl &, const unsigned &cpu)> ParallelFunc
Definition: qrack_types.hpp:126
QRACK_CONST complex I_CMPLX
Definition: qrack_types.hpp:241
std::shared_ptr< StateVector > StateVectorPtr
Definition: qrack_types.hpp:133
const real1 REAL1_EPSILON
Definition: qrack_types.hpp:157
QRACK_CONST complex ZERO_CMPLX
Definition: qrack_types.hpp:240
const real1 SQRT1_2_R1
Definition: qrack_types.hpp:160
#define QRACK_CONST
Definition: qrack_types.hpp:150
#define bitLenInt
Definition: qrack_types.hpp:44
#define bitCapInt
Definition: qrack_types.hpp:105
#define bitCapIntOcl
Definition: qrack_types.hpp:91
#define bitsInCap
Definition: qrack_types.hpp:104