Skip to content

Instantly share code, notes, and snippets.

@methane

methane/cython.c Secret

Last active July 23, 2018 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save methane/91533f68e88f89b7ec7f71855c069792 to your computer and use it in GitHub Desktop.
Save methane/91533f68e88f89b7ec7f71855c069792 to your computer and use it in GitHub Desktop.
/* "sage/matrix/matrix_generic_dense.pyx":369
* m = i*snc
* for k in range(snc):
* z += left._entries[m+k]._mul_(right._entries[k*nc+j]) # <<<<<<<<<<<<<<
* v[p] = z
* p += 1
*/
if (unlikely(__pyx_v_left->_entries == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 369, __pyx_L1_error)
}
__pyx_t_14 = (__pyx_v_m + __pyx_v_k);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_left->_entries, __pyx_t_14), __pyx_n_s_mul); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
if (unlikely(__pyx_v_right->_entries == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 369, __pyx_L1_error)
}
__pyx_t_14 = ((__pyx_v_k * __pyx_v_nc) + __pyx_v_j);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_5)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
}
}
if (!__pyx_t_5) {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, PyList_GET_ITEM(__pyx_v_right->_entries, __pyx_t_14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
// ....
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
PyObject *self, *result;
PyCFunction cfunc;
cfunc = PyCFunction_GET_FUNCTION(func);
self = PyCFunction_GET_SELF(func);
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
return NULL;
result = cfunc(self, arg);
Py_LeaveRecursiveCall();
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
PyErr_SetString(
PyExc_SystemError,
"NULL result without error in PyObject_Call");
}
return result;
}
/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
PyObject *result;
PyObject *args = PyTuple_New(1);
if (unlikely(!args)) return NULL;
Py_INCREF(arg);
PyTuple_SET_ITEM(args, 0, arg);
result = __Pyx_PyObject_Call(func, args, NULL);
Py_DECREF(args);
return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(func)) {
return __Pyx_PyFunction_FastCall(func, &arg, 1);
}
#endif
if (likely(PyCFunction_Check(func))) {
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
} else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
}
}
return __Pyx__PyObject_CallOneArg(func, arg);
}
+ 93.99% 0.00% python matrix0.so [.] __Pyx_PyObject_CallOneArg ◆
- 93.99% 21.32% python matrix_generic_dense.so [.] __pyx_pw_4sage_6matrix_20matrix_generic_dense_20Matrix_generic_dense_15_multiply_classical ▒
- 72.67% __pyx_pw_4sage_6matrix_20matrix_generic_dense_20Matrix_generic_dense_15_multiply_classical ▒
- 27.85% PyNumber_InPlaceAdd ▒
- __pyx_pw_4sage_9structure_7element_7Element_71__add__ ▒
12.52% _Z98__pyx_f_4sage_5rings_12finite_rings_14element_givaro_25FiniteField_givaroElement__add___pyx_wrap_1P80__pyx_obj_4sage_5rings_12finite_rings_14element_giv▒
- 9.21% _Z86__pyx_f_4sage_5rings_12finite_rings_14element_givaro_25FiniteField_givaroElement__add_P80__pyx_obj_4sage_5rings_12finite_rings_14element_givaro_FiniteFie▒
- _ZL83__pyx_f_4sage_5rings_12finite_rings_14element_givaro_make_FiniteField_givaroElementP67__pyx_obj_4sage_5rings_12finite_rings_14element_givaro_Cache_givaroi ▒
_ZL21__Pyx_GetItemInt_FastP7_objectliii.constprop.271 ▒
1.86% __pyx_f_4sage_9structure_7element_classify_elements ▒
- 20.86% __pyx_tp_getattro_4sage_9structure_7element_Element ▒
- 9.64% __Pyx_PyObject_GenericGetAttrNoDict ▒
7.25% method_get ▒
2.40% _PyType_Lookup@plt ▒
9.59% __Pyx_PyObject_GenericGetAttr ▒
- 15.28% _ZL89__pyx_pw_4sage_5rings_12finite_rings_14element_givaro_25FiniteField_givaroElement_21_mul_P7_objectS0_ ▒
- 7.89% _Z86__pyx_f_4sage_5rings_12finite_rings_14element_givaro_25FiniteField_givaroElement__mul_P80__pyx_obj_4sage_5rings_12finite_rings_14element_givaro_FiniteField_▒
- _ZL83__pyx_f_4sage_5rings_12finite_rings_14element_givaro_make_FiniteField_givaroElementP67__pyx_obj_4sage_5rings_12finite_rings_14element_givaro_Cache_givaroi ▒
_ZL21__Pyx_GetItemInt_FastP7_objectliii.constprop.271 ▒
6.73% 0xcc08 ▒
5.38% PyNumber_InPlaceAdd@plt ▒
3.26% meth_dealloc ▒
- 16.15% __pyx_pw_4sage_9structure_7element_6Matrix_1__mul__ ▒
__pyx_f_4sage_6matrix_7matrix0_6Matrix__matrix_times_matrix_ ▒
__Pyx_PyObject_CallOneArg ▒
- __pyx_pw_4sage_6matrix_20matrix_generic_dense_20Matrix_generic_dense_15_multiply_classical ▒
1.04% meth_dealloc ▒
- 5.17% __Pyx_PyObject_CallOneArg ▒
__pyx_pw_4sage_6matrix_20matrix_generic_dense_20Matrix_generic_dense_15_multiply_classical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment