On Wed, Oct 17, 2012 at 11:38 AM, Sebastian Walter <sebastian.wal...@gmail.com> wrote: > I'd like to have a look at the implementation of iadd in numpy, > but I'm having a real hard time to find the corresponding code. > > I'm basically stuck at > https://github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/number.c#L487
n_ops is essentially a map of function pointers set in the umath module (see PyArray_SetNumericOps, used in umath module). IOW, n_ops.add is a pointer to umath.add, itself set up through a generated file __umath_generated.c: f = PyUFunc_FromFuncAndData(add_functions, ...); PyDict_SetItemString(dictionary, "add", f); At that point, you need to look into the ufunc machinery: for double all along, the add type resolver should be pretty simple and in the end call DOUBLE_add. > > Could someone give me a pointer where to find it? > Respectively, could someone point me to some documentation where the > (folder/file) structure of the numpy sources is explained? There is sadly not much explanation on the code structure for the C part. src/multiarray contains the code for the multiarray extension (array, dtype, broadcasting, iteration) and src/umath contains the code for the umath extension (ufunc machinery + core loops implementation). David _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion