diff --git a/ckron/build/lib.linux-x86_64-3.7/ckron/cythkrn.cpython-37m-x86_64-linux-gnu.so b/ckron/build/lib.linux-x86_64-3.7/ckron/cythkrn.cpython-37m-x86_64-linux-gnu.so index 2b473fb..2440399 100755 Binary files a/ckron/build/lib.linux-x86_64-3.7/ckron/cythkrn.cpython-37m-x86_64-linux-gnu.so and b/ckron/build/lib.linux-x86_64-3.7/ckron/cythkrn.cpython-37m-x86_64-linux-gnu.so differ diff --git a/ckron/build/temp.linux-x86_64-3.7/cythkrn.o b/ckron/build/temp.linux-x86_64-3.7/cythkrn.o index 8657d38..de5254c 100644 Binary files a/ckron/build/temp.linux-x86_64-3.7/cythkrn.o and b/ckron/build/temp.linux-x86_64-3.7/cythkrn.o differ diff --git a/ckron/cythkrn.c b/ckron/cythkrn.c index 0200227..e183e66 100644 --- a/ckron/cythkrn.c +++ b/ckron/cythkrn.c @@ -2198,7 +2198,7 @@ static PyObject *__pyx_codeobj__27; /* Python wrapper */ static PyObject *__pyx_pw_5ckron_7cythkrn_1kron(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5ckron_7cythkrn_kron[] = "\n Calculates a Kronicker product using C.\n TODO: Crashes on 31 qubits since it overflows the int"; +static char __pyx_doc_5ckron_7cythkrn_kron[] = "\n Calculates a Kronicker product using C.\n TODO: Crashes on 31 qubits since it overflows the int\n\n While calculating 31 qbits, get \"negative dimensions\" - hint towards \"Int overflow\":::\n\n Traceback (most recent call last):\n File \"/usr/local/google/home/pisquared/workspace/quantum/load_test.py\", line 127, in \n run_load_test(32)\n File \"/usr/local/google/home/pisquared/workspace/quantum/load_test.py\", line 108, in run_load_test\n m = kron(qbits)\n File \"ckron/cythkrn.pyx\", line 15, in ckron.cythkrn.kron\n result = np.zeros((i*k, j*l), float)\n ValueError: negative dimensions are not allowed\n\n "; static PyMethodDef __pyx_mdef_5ckron_7cythkrn_1kron = {"kron", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5ckron_7cythkrn_1kron, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5ckron_7cythkrn_kron}; static PyObject *__pyx_pw_5ckron_7cythkrn_1kron(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __Pyx_memviewslice __pyx_v_a = { 0, 0, { 0 }, { 0 }, { 0 } }; @@ -2292,17 +2292,17 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel Py_ssize_t __pyx_t_18; __Pyx_RefNannySetupContext("kron", 0); - /* "ckron/cythkrn.pyx":25 - * Calculates a Kronicker product using C. - * TODO: Crashes on 31 qubits since it overflows the int""" + /* "ckron/cythkrn.pyx":38 + * + * """ * cdef int i = a.shape[0] # <<<<<<<<<<<<<< * cdef int j = a.shape[1] * cdef int k = b.shape[0] */ __pyx_v_i = (__pyx_v_a.shape[0]); - /* "ckron/cythkrn.pyx":26 - * TODO: Crashes on 31 qubits since it overflows the int""" + /* "ckron/cythkrn.pyx":39 + * """ * cdef int i = a.shape[0] * cdef int j = a.shape[1] # <<<<<<<<<<<<<< * cdef int k = b.shape[0] @@ -2310,7 +2310,7 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel */ __pyx_v_j = (__pyx_v_a.shape[1]); - /* "ckron/cythkrn.pyx":27 + /* "ckron/cythkrn.pyx":40 * cdef int i = a.shape[0] * cdef int j = a.shape[1] * cdef int k = b.shape[0] # <<<<<<<<<<<<<< @@ -2319,7 +2319,7 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel */ __pyx_v_k = (__pyx_v_b.shape[0]); - /* "ckron/cythkrn.pyx":28 + /* "ckron/cythkrn.pyx":41 * cdef int j = a.shape[1] * cdef int k = b.shape[0] * cdef int l = b.shape[1] # <<<<<<<<<<<<<< @@ -2328,7 +2328,7 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel */ __pyx_v_l = (__pyx_v_b.shape[1]); - /* "ckron/cythkrn.pyx":29 + /* "ckron/cythkrn.pyx":42 * cdef int k = b.shape[0] * cdef int l = b.shape[1] * cdef int onei = 1 # <<<<<<<<<<<<<< @@ -2337,7 +2337,7 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel */ __pyx_v_onei = 1; - /* "ckron/cythkrn.pyx":30 + /* "ckron/cythkrn.pyx":43 * cdef int l = b.shape[1] * cdef int onei = 1 * cdef double oned = 1 # <<<<<<<<<<<<<< @@ -2346,23 +2346,23 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel */ __pyx_v_oned = 1.0; - /* "ckron/cythkrn.pyx":32 + /* "ckron/cythkrn.pyx":45 * cdef double oned = 1 * cdef int m, n * result = np.zeros((i*k, j*l), float) # <<<<<<<<<<<<<< * cdef double[:, ::1] result_v = result * for n in range(i): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_i * __pyx_v_k)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_i * __pyx_v_k)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_j * __pyx_v_l)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_j * __pyx_v_l)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); @@ -2385,7 +2385,7 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, ((PyObject *)(&PyFloat_Type))}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -2394,14 +2394,14 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, ((PyObject *)(&PyFloat_Type))}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { - __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -2412,7 +2412,7 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type))); PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, ((PyObject *)(&PyFloat_Type))); __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -2420,19 +2420,19 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "ckron/cythkrn.pyx":33 + /* "ckron/cythkrn.pyx":46 * cdef int m, n * result = np.zeros((i*k, j*l), float) * cdef double[:, ::1] result_v = result # <<<<<<<<<<<<<< * for n in range(i): * for m in range(k): */ - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_result, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_result, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 46, __pyx_L1_error) __pyx_v_result_v = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "ckron/cythkrn.pyx":34 + /* "ckron/cythkrn.pyx":47 * result = np.zeros((i*k, j*l), float) * cdef double[:, ::1] result_v = result * for n in range(i): # <<<<<<<<<<<<<< @@ -2444,7 +2444,7 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_n = __pyx_t_9; - /* "ckron/cythkrn.pyx":35 + /* "ckron/cythkrn.pyx":48 * cdef double[:, ::1] result_v = result * for n in range(i): * for m in range(k): # <<<<<<<<<<<<<< @@ -2456,7 +2456,7 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_m = __pyx_t_12; - /* "ckron/cythkrn.pyx":36 + /* "ckron/cythkrn.pyx":49 * for n in range(i): * for m in range(k): * blas.dger(&l, &j, &oned, &b[m, 0], &onei, &a[n, 0], &onei, &result_v[m+k*n, 0], &l) # <<<<<<<<<<<<<< @@ -2472,7 +2472,7 @@ static PyObject *__pyx_pf_5ckron_7cythkrn_kron(CYTHON_UNUSED PyObject *__pyx_sel } } - /* "ckron/cythkrn.pyx":37 + /* "ckron/cythkrn.pyx":50 * for m in range(k): * blas.dger(&l, &j, &oned, &b[m, 0], &onei, &a[n, 0], &onei, &result_v[m+k*n, 0], &l) * return result # <<<<<<<<<<<<<< @@ -16201,7 +16201,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 47, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 133, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error) diff --git a/lib_q_computer_math.py b/lib_q_computer_math.py index 19a41b8..3923760 100644 --- a/lib_q_computer_math.py +++ b/lib_q_computer_math.py @@ -1222,7 +1222,7 @@ def test_light(): if __name__ == "__main__": - # test() + test() # test_quantum_processor() # test_light() - test_measure_partial() + # test_measure_partial()