Generated by Cython 0.22
Raw output: _home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0.c
01:
+02: include "interrupt.pxi" # ctrl-c interrupt block support
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
03: include "stdsage.pxi"
04:
05: include "cdefs.pxi"
06: from sage.libs.gmp.mpz cimport *
07: from sage.rings.integer cimport Integer
+08: def trialdivision(n):
/* Python wrapper */ static PyObject *__pyx_pw_75_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0_1trialdivision(PyObject *__pyx_self, PyObject *__pyx_v_n); /*proto*/ static char __pyx_doc_75_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0_trialdivision[] = "File: _home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0.pyx (starting at line 8)"; static PyMethodDef __pyx_mdef_75_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0_1trialdivision = {"trialdivision", (PyCFunction)__pyx_pw_75_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0_1trialdivision, METH_O, __pyx_doc_75_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0_trialdivision}; static PyObject *__pyx_pw_75_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0_1trialdivision(PyObject *__pyx_self, PyObject *__pyx_v_n) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trialdivision (wrapper)", 0); __pyx_r = __pyx_pf_75_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0_trialdivision(__pyx_self, ((PyObject *)__pyx_v_n)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_75_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0_trialdivision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n) { struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_i = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trialdivision", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0.trialdivision", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_i); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__2 = PyTuple_Pack(2, __pyx_n_s_n, __pyx_n_s_i); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* … */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_75_home_jdemeyer__sage_sage_notebook_sagenb_home_admin_162_code_sage70_spyx_0_1trialdivision, NULL, __pyx_n_s_home_jdemeyer__sage_sage_notebo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_trialdivision, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+09: cdef Integer i = Integer(2)
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4sage_5rings_7integer_Integer)), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_i = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_int_2); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
+10: while i*i <= n:
while (1) { __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_n, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_3) break;
+11: sig_check()
__pyx_t_4 = sig_check(); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+12: if mpz_divisible_p((<Integer?>n).value, i.value):
if (!(likely(__Pyx_TypeTest(__pyx_v_n, __pyx_ptype_4sage_5rings_7integer_Integer)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = (mpz_divisible_p(((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_v_n)->value, __pyx_v_i->value) != 0); if (__pyx_t_3) {
+13: return i
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_i)); __pyx_r = ((PyObject *)__pyx_v_i); goto __pyx_L0; }
+14: i = i._add_long(1)
__pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_4sage_5rings_7integer_Integer *)__pyx_v_i->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base._add_long(((struct __pyx_obj_4sage_9structure_7element_RingElement *)__pyx_v_i), 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4sage_5rings_7integer_Integer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_i, ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_2)); __pyx_t_2 = 0; }