-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Nditer tut #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nditer tut #138
Conversation
Excellent tutorial! |
Very nice. |
Thanks for the feedback! I've added a new commit with links to this document from the two main places most people will start from. |
inner loop out of the iterator and into your code. This way, NumPy's | ||
vectorized operations can be used on larger chunks of the elements | ||
being visited. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might give a short explanation/justification of calling this an External Loop. The wording is slightly confusing because it's not immediately clear how it relates to the 'inner loops' in, say, ufuncs. I'm not sure if external loop here refers to it being external to python or more like an outer loop.
Great tutorial. It'll be a great reference when I use the nditer for vectorizing stuff. |
I've updated it to try to improve the areas pointed out by Chris. Thanks for the feedback! |
|
||
When adding the 'out' parameter, we have to explicitly provide those flags, | ||
because if someone passes in an array as 'out', the iterator will default | ||
to 'readonly', and our inner loop would fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explaining why the interator defaults to readonly might help clarify this bit. I assume it is because of potential overlaps.
I've added a little more explaining why the iterator defaults operands to read-only. |
feat: Add vsub_[s8|s16|s32|s64|u8|u16|u32|u64|f32]
Because of a query from Neal Becker (http://mail.scipy.org/pipermail/numpy-discussion/2011-August/058031.html), I've written an introductory tutorial-style document about the nditer in Python. This walks through nditer usage starting with basic iteration of one array, through broadcasting and iterator-allocated outputs, and finally covers accelerating the inner loop with Cython.
Please review and try out the examples!