I expected this code to be efficient, and wanted to see what c++ code it 
produced:

def test3 (np.ndarray[np.complex128_t, ndim=1] in1):
    cdef int xmax = in1.shape[0]
    for i in range (xmax):
        in1[i].imag = 0

    /* "/home/nbecker/raysat/mod/test2.pyx":27
 *     cdef int xmax = in1.shape[0]
 *     for i in range (xmax):
 *         in1[i].imag = 0             # <<<<<<<<<<<<<<
 * 
 */
    __pyx_t_2 = PyObject_GetItem(__pyx_v_in1, __pyx_v_i); if (!__pyx_t_2) 
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; 
goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyObject_SetAttr(__pyx_t_2, __pyx_n_ui_imag, __pyx_int_0) < 0) 
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; 
goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }

...

Looks to me like it's using 'SetAttr' to set the .imag value.  Not good.



_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to