@@ -63,10 +63,9 @@ static inline double expected_closeness_weight(size_t n_rows, size_t n_cols, siz
6363 return 2.0 * mu_k - 1.0 ;
6464}
6565
66- static inline std::vector<double > probability_by_hamming_weight (double J, double h, double theta, double t, size_t n_qubits)
66+ static inline std::vector<double > probability_by_hamming_weight (double J, double h, size_t z, double theta, double t, size_t n_qubits)
6767{
6868 // critical angle
69- const size_t z = 4U ;
7069 const double theta_c = std::asin (h / (z * J));
7170 const double delta_theta = theta - theta_c;
7271 std::vector<double > bias;
@@ -103,7 +102,7 @@ static inline std::vector<double> probability_by_hamming_weight(double J, double
103102 return bias;
104103}
105104
106- std::vector<std::string> generate_tfim_samples_cpp (double J, double h, double theta, double t, size_t n_qubits, size_t shots) {
105+ std::vector<std::string> generate_tfim_samples_cpp (double J, double h, size_t z, double theta, double t, size_t n_qubits, size_t shots) {
107106 // lattice dimensions
108107 size_t n_rows = 1U ;
109108 size_t n_cols = n_qubits;
@@ -115,7 +114,7 @@ std::vector<std::string> generate_tfim_samples_cpp(double J, double h, double th
115114 }
116115 }
117116
118- const std::vector<double > bias = probability_by_hamming_weight (J, h, theta, t, n_qubits);
117+ const std::vector<double > bias = probability_by_hamming_weight (J, h, z, theta, t, n_qubits);
119118
120119 // thresholds
121120 std::vector<double > thresholds (n_qubits + 1 );
@@ -189,8 +188,8 @@ std::vector<std::string> generate_tfim_samples_cpp(double J, double h, double th
189188 return output;
190189}
191190
192- double tfim_magnetization (double J, double h, double theta, double t, size_t n_qubits) {
193- const std::vector<double > bias = probability_by_hamming_weight (J, h, theta, t, n_qubits);
191+ double tfim_magnetization (double J, double h, size_t z, double theta, double t, size_t n_qubits) {
192+ const std::vector<double > bias = probability_by_hamming_weight (J, h, z, theta, t, n_qubits);
194193 double magnetization = 0.0 ;
195194 for (size_t q = 0U ; q < bias.size (); ++q) {
196195 const double mag = (n_qubits - 2.0 * q) / n_qubits;
@@ -200,8 +199,8 @@ double tfim_magnetization(double J, double h, double theta, double t, size_t n_q
200199 return magnetization;
201200}
202201
203- double tfim_square_magnetization (double J, double h, double theta, double t, size_t n_qubits) {
204- const std::vector<double > bias = probability_by_hamming_weight (J, h, theta, t, n_qubits);
202+ double tfim_square_magnetization (double J, double h, size_t z, double theta, double t, size_t n_qubits) {
203+ const std::vector<double > bias = probability_by_hamming_weight (J, h, z, theta, t, n_qubits);
205204 double square_magnetization = 0.0 ;
206205 for (size_t q = 0U ; q < bias.size (); ++q) {
207206 const double mag = (n_qubits - 2.0 * q) / n_qubits;
@@ -214,13 +213,13 @@ double tfim_square_magnetization(double J, double h, double theta, double t, siz
214213PYBIND11_MODULE (tfim_sampler, m) {
215214 m.doc () = " PyQrackIsing TFIM sample generator" ;
216215 m.def (" _generate_tfim_samples" , &generate_tfim_samples_cpp,
217- py::arg (" J" ), py::arg (" h" ), py::arg (" theta " ), py::arg (" t " ),
218- py::arg (" n_qubits" ), py::arg (" shots" ));
216+ py::arg (" J" ), py::arg (" h" ), py::arg (" z " ), py::arg (" theta " ),
217+ py::arg (" t " ), py::arg ( " n_qubits" ), py::arg (" shots" ));
219218 m.def (" _tfim_magnetization" , &tfim_magnetization,
220- py::arg (" J" ), py::arg (" h" ), py::arg (" theta " ), py::arg (" t " ),
221- py::arg (" n_qubits" ));
219+ py::arg (" J" ), py::arg (" h" ), py::arg (" z " ), py::arg (" theta " ),
220+ py::arg (" t " ), py::arg ( " n_qubits" ));
222221 m.def (" _tfim_square_magnetization" , &tfim_square_magnetization,
223- py::arg (" J" ), py::arg (" h" ), py::arg (" theta " ), py::arg (" t " ),
224- py::arg (" n_qubits" ));
222+ py::arg (" J" ), py::arg (" h" ), py::arg (" z " ), py::arg (" theta " ),
223+ py::arg (" t " ), py::arg ( " n_qubits" ));
225224}
226225
0 commit comments