Generated by Cython 0.10.2 on Wed Apr 8 16:10:24 2009
Raw output: _Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0.c
1:
#if PY_MAJOR_VERSION < 3
return;
#else
return __pyx_m;
#endif
__pyx_L1_error:;
__Pyx_AddTraceback("_Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0");
#if PY_MAJOR_VERSION >= 3
return NULL;
#endif
}
2: include "interrupt.pxi" # ctrl-c interrupt block support
3: include "stdsage.pxi" # ctrl-c interrupt block support
4:
5: include "cdefs.pxi"
6: cdef double f(double x):
static double __pyx_f_73_Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0_f(double __pyx_v_x) { double __pyx_r;
7: return x+x
__pyx_r = (__pyx_v_x + __pyx_v_x); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; return __pyx_r; }
8:
9: def time_f(double x, int N):
static PyObject *__pyx_pf_73_Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0_time_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_73_Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0_time_f[] = "File: _Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0.pyx (starting at line 9)"; static PyObject *__pyx_pf_73_Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0_time_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_x; int __pyx_v_N; int __pyx_v_i; double __pyx_v_a; PyObject *__pyx_r; static PyObject **__pyx_pyargnames[] = {&__pyx_kp_x,&__pyx_kp_N,0}; __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { PyObject* values[2] = {0,0}; Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_N); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("time_f", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "time_f") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_N = __pyx_PyInt_int(values[1]); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { __pyx_v_x = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_N = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("time_f", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0.time_f"); return NULL; __pyx_L4_argument_unpacking_done:;
10: cdef int i
11: cdef double a
12: for i from 0 <= i < N:
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_N; __pyx_v_i++) {
13: a += f(i)
__pyx_v_a += __pyx_f_73_Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0_f(__pyx_v_i); }
14: return a
__pyx_1 = PyFloat_FromDouble(__pyx_v_a); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_1; __pyx_1 = 0; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); __Pyx_AddTraceback("_Users_robert__sage_sage_notebook_worksheets_admin_22_code_sage458_spyx_0.time_f"); __pyx_r = NULL; __pyx_L0:; return __pyx_r; }