31
31
// #include "noise_gate_BCSZ_0.98.cuh"
32
32
// #include "noise_gate_BCSZ_0.99.cuh"
33
33
34
- #include " noise_gate_BCSZ_1_array.cuh"
34
+ // #include "noise_gate_BCSZ_1_array.cuh"
35
35
36
36
#include " config.hpp"
37
37
@@ -524,8 +524,8 @@ public:
524
524
// For density matrix, we need double the qubits
525
525
this ->n_qubits = _n_qubits;
526
526
this ->n_gates = _n_gates;
527
- this ->dim = ((IdxType)1UL <<(2 *n_qubits));
528
- this ->half_dim = (IdxType)1UL <<(2 *n_qubits-1UL );
527
+ this ->dim = ((IdxType)1 <<(2 *n_qubits));
528
+ this ->half_dim = (IdxType)1 <<(2 *n_qubits-1 );
529
529
this ->sv_size = dim*(IdxType)sizeof (ValType);
530
530
}
531
531
std::string circuitToString ()
@@ -682,21 +682,21 @@ __global__ void simulation_kernel(Simulation* sim)
682
682
for (IdxType i=tid; i<(sim->half_dim);\
683
683
i+=blockDim .x*gridDim .x){ \
684
684
IdxType outer = (i >> qubit); \
685
- IdxType inner = (i & ((1UL <<qubit)-1UL )); \
686
- IdxType offset = (outer << (qubit+1UL )); \
685
+ IdxType inner = (i & (((IdxType) 1 <<qubit)-1 )); \
686
+ IdxType offset = (outer << (qubit+1 )); \
687
687
IdxType pos0 = offset + inner; \
688
- IdxType pos1 = pos0 + (1UL <<qubit);
688
+ IdxType pos1 = pos0 + ((IdxType) 1 <<qubit);
689
689
690
690
// Define MG-BSP machine operation header with a mask for multi-controlled gates
691
691
#define OP_HEAD_MASK grid_group grid = this_grid(); \
692
692
const IdxType tid = blockDim .x * blockIdx .x + threadIdx .x ; \
693
693
for (IdxType i=tid; i<(sim->half_dim );\
694
694
i+=blockDim .x *gridDim .x ){ \
695
695
IdxType outer = (i >> qubit); \
696
- IdxType inner = (i & ((1UL <<qubit)-1UL )); \
697
- IdxType offset = (outer << (qubit+1UL )); \
696
+ IdxType inner = (i & (((IdxType) 1 <<qubit)-1 )); \
697
+ IdxType offset = (outer << (qubit+1 )); \
698
698
IdxType pos0 = offset + inner; \
699
- IdxType pos1 = pos0 + (1UL <<qubit); \
699
+ IdxType pos1 = pos0 + ((IdxType) 1 <<qubit); \
700
700
if (((~(pos0&mask))&mask) != 0 ) continue ;
701
701
702
702
// Define MG-BSP machine operation footer
@@ -1965,7 +1965,7 @@ __device__ __inline__ void Measure_GATE(const Gate* g, const Simulation* sim, Va
1965
1965
const int tid = blockDim .x * blockIdx .x + threadIdx .x ;
1966
1966
1967
1967
ValType * m_real = sim->m_real ;
1968
- IdxType mask = (1UL <<qubit);
1968
+ IdxType mask = ((IdxType) 1 <<qubit);
1969
1969
1970
1970
if (pauli == 1 )
1971
1971
{
@@ -1980,7 +1980,7 @@ __device__ __inline__ void Measure_GATE(const Gate* g, const Simulation* sim, Va
1980
1980
H_GATE (sim, sv_real, sv_imag, sim->n_qubits +qubit);
1981
1981
}
1982
1982
1983
- for (IdxType i = tid; i<(1UL <<(sim->n_qubits )); i+=blockDim .x *gridDim .x )
1983
+ for (IdxType i = tid; i<((IdxType) 1 <<(sim->n_qubits )); i+=blockDim .x *gridDim .x )
1984
1984
{
1985
1985
if ( (i & mask) == 0 ) // for all conditions with qubit=0, we set it to 0, so we sum up all prob that qubit=1
1986
1986
{
0 commit comments